rename pocketbase to client

This commit is contained in:
Martz
2023-02-05 17:07:42 +01:00
parent 35b680e712
commit 1de3d4d395

27
src/Client.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
namespace Pb;
class Client
{
private string $response;
private string $url;
public function __construct(string $url)
{
$this->response = '{}';
$this->url = $url;
}
public function collection(string $collection, int $page = 1)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url."/api/collections/".$collection."/records?page=".$page);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$this->response = curl_exec($ch);
curl_close($ch);
return json_decode($this->response, JSON_FORCE_OBJECT);
}
}