1. Go to this page and download the library: Download mesahub/client 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/ */
mesahub / client example snippets
use Mesahub\MesahubClient;
$client = new MesahubClient(
apiKey: 'shs_your_api_key', // from mesahub.app → Settings → API Keys
apiUrl: 'https://api.mesahub.app', // or your dedicated / self-hosted instance URL
);
$db = $client->db('my-app-db'); // your database slug from the dashboard
$users = $db->table('users');
// High-level table API
$all = $users->find(where: ['active' => 1], limit: 20);
$alice = $users->findOne(where: ['email' => '[email protected]']);
$count = $users->count(where: ['active' => 1]);
$newRow = $users->insert(['name' => 'Bob', 'email' => '[email protected]', 'active' => 1]);
$users->update(where: ['id' => $newRow['id']], set: ['name' => 'Robert']);
$users->delete(where: ['id' => $newRow['id']]);
// Raw SQL
$result = $db->query('SELECT * FROM users WHERE active = ?', [1]);
print_r($result->rows);
$db->exec('CREATE TABLE IF NOT EXISTS logs (msg TEXT, created_at TEXT)');