1. Go to this page and download the library: Download adaiasmagdiel/loxodontu-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
adaiasmagdiel / loxodontu-php example snippets
use AdaiasMagdiel\Loxodontu\Client;
$loxo = new Client(
'https://your-app.example.com/api/v1',
'my-project', // project id / slug
'PROJECT_API_KEY',
);
// A chain ends with an explicit ->get() (PHP has no thenable to auto-execute on await).
$response = $loxo->from('todos')
->select()
->eq('done', false)
->order('created_at', ascending: false)
->limit(20)
->get();
$todos = $response->data;
$loxo->from('todos')->insert(['title' => 'Write docs'])->get();
$loxo->from('todos')->update(['id' => 1, 'done' => true])->get(); // single row, id in the body
$loxo->from('todos')->update(['done' => true])->eq('done', false)->get(); // bulk, by filter
$loxo->from('todos')->delete()->eq('id', 1)->get(); // single row, by filter
$loxo->from('todos')->delete()->lt('views', 10)->get(); // bulk, by filter
$loxo->from('todos')->delete([2, 3, 4])->get(); // bulk, by id list
// End users (your app's own users, separate from your platform account)
$loxo->auth->register('[email protected]', 'password123');
$loxo->auth->login('[email protected]', 'password123'); // token stored & sent automatically
$loxo->auth->logout();
// Edge functions
$response = $loxo->functions->invoke('daily-cleanup', body: ['source' => 'client']);
final class LoxodontuResponse
{
public readonly mixed $data;
public readonly ?array $error; // ['message' => string, 'status' => int]
public readonly ?int $count; // from X-Total-Count on paginated list endpoints
public readonly int $status;
}