commit e6ce2ec650f5e63d3a74fb47e796be7b9553509d Author: Martz Date: Sun Feb 5 16:52:09 2023 +0100 Initial commit diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..1166d59 --- /dev/null +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "name": "mkay-development/pocketbase-php-sdk", + "license": "MIT", + "authors": [ + { + "name": "Jonathan Martz", + "role": "Maintainer" + } + ], + "autoload": { + "autoload": { + "psr-4": { + "App\\": "src/" + } + } + }, + "require": { + "php": "^8.1|^8.2", + "ext-curl": "*" + } +} \ No newline at end of file diff --git a/src/Pocketbase.php b/src/Pocketbase.php new file mode 100644 index 0000000..2c5005b --- /dev/null +++ b/src/Pocketbase.php @@ -0,0 +1,24 @@ +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); + } + +}