1. Go to this page and download the library: Download litebase/litebase-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/ */
litebase / litebase-php example snippets
use Litebase\Configuration;
use Litebase\LitebasePDO;
$pdo = new LitebasePDO([
'host' => 'localhost',
'port' => 8888,
'token' => 'your_api_token',
'database' => 'your_database_name/main',
]);
$statement = $pdo->prepare('SELECT * FROM users WHERE id = ?');
$statement->execute([1]);
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
print_r($row);
}
// Use transactions
$pdo = $pdo->beginTransaction();
try {
$statement = $pdo->prepare('INSERT INTO users (name, email) VALUES (?, ?)');
$statement->execute(['John Doe', '[email protected]']);
$statement = $pdo->prepare('INSERT INTO logs (user_id, action) VALUES (?, ?)');
$statement->execute([$pdo->lastInsertId(), 'user_created']);
$pdo->commit();
} catch (\Exception $e) {
$pdo->rollBack();
throw $e;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.