Initial commit

This commit is contained in:
Martz
2023-02-05 16:52:09 +01:00
commit e6ce2ec650
2 changed files with 45 additions and 0 deletions

24
src/Pocketbase.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
class Pocketbase
{
private string|bool $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);
}
}