litebase / litebase-php
Litebase PHP SDK
Fund package maintenance!
litebase
Installs: 30
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/litebase/litebase-php
Requires
- php: ^8.4
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: ^7.9
- guzzlehttp/psr7: ^1.7 || ^2.0
- ramsey/uuid: ^4.9
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- illuminate/database: ^11.0|^12.0
- laravel/pint: ^1.25
- mockery/mockery: ^1.6.10
- pestphp/pest: ^4.1
- phpstan/phpstan: ^2.1
This package is auto-updated.
Last update: 2025-11-26 21:24:29 UTC
README
A PHP SDK for interacting with Litebase, an open source distributed database built on SQLite, distributed file systems, and object storage.
Installation
You can install the package via composer:
composer require litebase/litebase-php
Usage
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', 'john@example.com']); $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; }
Contributing
Please see CONTRIBUTING for details.
Testing
You can run the tests:
composer test
Integration tests require a running Litebase Server. When running integration tests, a server will be automatically started using Docker. You can run the tests with:
composer test-integration
Code of Conduct
Please see CODE OF CONDUCT for details.
Security
All security related issues should be reported directly to security@litebase.com.
License
Litebase is open-sourced software licensed under the MIT License.