1. Go to this page and download the library: Download rexpl/libsql 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/ */
rexpl / libsql example snippets
$libsql = new \Rexpl\Libsql\Libsql('libsql://127.0.0.1:8080', $token);
$results = $libsql->query('SELECT * FROM users WHERE id = 1');
$user = $results->fetch();
// or
$numberOfAffectedRows = $libsql->exec('UPDATE users SET email = "[email protected]" WHERE id = 1');
$libsql = new \Rexpl\Libsql\Libsql('libsql://127.0.0.1:8080', $token);
$results = $libsql->query('SELECT * FROM users WHERE id = ?', [$userId]);
$user = $results->fetch(\Rexpl\Libsql\Libsql::FETCH_OBJ);
// or with named arguments
$query = $libsql->prepare('SELECT * FROM users WHERE email LIKE :email');
$results = $query->execute(['email' => '%@example.com']);
$posts = $results->fetchAll(\Rexpl\Libsql\Libsql::FETCH_ASSOC);