This is a minimal PHP implementation of the Supabase API wich is supported by PostgREST. It contains only the methods I needed. However, I'm open to PRs that add extra methods to the client.
Supabase-api is built with help of the awesome Saloon package.
Be aware that is a work in progress, it's in pre-alpha state, use it at your own risk.
Here are a few examples on how you can use the package:
You can install the package via composer:
composer require juanbenitez/supabase-api
Define a request class for a table in your DB.
use Juanbenitez\SupabaseApi\Request\ReadRowsRequest;
class UsersReadRowsRequest extends ReadRowsRequest
{
protected ?string $table = 'users';
}
$connector = new SupabaseConnector('https://testbaseurl.supabase.co/rest/v1/', 'TEST_SUPABASE_SERVICE_KEY');
$usersRequest = $connector->request(new UsersReadRowsRequest());
$usersRequest->select(['last_name', 'first_name', 'age'])
->where('age', '18')
->orderBy('created_at', 'desc')
->limit(5);
$response = $usersRequest->send();
$response->throw();
echo "status:". $response->status() . PHP_EOL;
print_r ($response->json());
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.