1. Go to this page and download the library: Download dolthub/doltlite-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/ */
dolthub / doltlite-php example snippets
use Doltlite\Doltlite3;
$db = new Doltlite3('app.db');
$db->exec('CREATE TABLE users(id INTEGER PRIMARY KEY, name TEXT)');
$stmt = $db->prepare('INSERT INTO users(name) VALUES (:name)');
$stmt->bindValue(':name', 'Ada');
$stmt->execute();
// Version control is plain SQL on the same connection.
$db->querySingle("SELECT dolt_commit('-A', '-m', 'add ada')");
$db->querySingle("SELECT dolt_checkout('-b', 'experiment')");
$db->exec("UPDATE users SET name = 'Grace' WHERE id = 1");
$db->querySingle("SELECT dolt_commit('-A', '-m', 'rename')");
$db->querySingle("SELECT dolt_checkout('main')");
$db->querySingle("SELECT dolt_merge('experiment')");
$log = $db->query('SELECT commit_hash, message FROM dolt_log');
while (($commit = $log->fetchArray(DOLTLITE3_ASSOC)) !== false) {
echo "{$commit['commit_hash']} {$commit['message']}\n";
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.