turso / libsql
libSQL bindings for PHP
v0.2.1
2025-01-11 00:13 UTC
Requires
- php: >=8.3
- ext-ffi: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- phpstan/phpstan: 2.0.x-dev
- phpunit/phpunit: ^11
This package is auto-updated.
Last update: 2025-01-11 00:15:32 UTC
README
libSQL PHP
Databases for PHP multi-tenant AI Apps.
Turso · Docs · Quickstart · SDK Reference · Blog & Tutorials
Features
- 🔌 Works offline with Embedded Replicas
- 🌎 Works with remote Turso databases
- ✨ Works with Turso AI & Vector Search
Warning
This SDK is currently in technical preview. Join us in Discord to report any issues.
Install
composer require turso/libsql
Quickstart
The example below uses Embedded Replicas and syncs data every 1000ms from Turso.
<?php use Libsql\Database; $db = new Database( path: 'local.db', url: getenv('TURSO_DATABASE_URL'), authToken: getenv('TURSO_AUTH_TOKEN') syncInterval: 1000 ); $conn = $db->connect(); $createUsers = " CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT ); INSERT INTO users (name) VALUES ('Iku'); "; $conn->executeBatch($createUsers); $conn->query("SELECT * FROM users WHERE id = ?", [1])->fetchArray();
Documentation
Visit our official documentation.
Support
Join us on Discord to get help using this SDK. Report security issues via email.
Contributors
See the contributing guide to learn how to get involved.