Repository navigation
Laravel
darkterminal edited this page Nov 11, 2026
·
1 revision
Works out of the box with Laravel 12 — no manual provider registration.
composer require darkterminal/turso-client-httpLaravel auto-discovers Darkterminal\TursoHttp\Laravel\TursoServiceProvider
from the package manifest.
.env:
DB_URL=libsql://<db>-<org>.turso.io
DB_TOKEN=<your-token>
# Local alternatives are also honored: TURSO_URL / TURSO_TOKENOptional — publish the config to see defaults or override:
php artisan vendor:publish --provider="Darkterminal\TursoHttp\Laravel\TursoServiceProvider" --tag=turso-http-configconfig/turso-http.php:
return [
'url' => env('DB_URL', env('TURSO_URL', 'http://127.0.0.1:8081')),
'token' => env('DB_TOKEN', env('TURSO_TOKEN', '')),
'options' => [], // optional closures, e.g. before_hook / after_hook
];use Darkterminal\TursoHttp\Laravel\Turso;
$version = Turso::version();
Turso::execute('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)');
Turso::execute('INSERT INTO users (name) VALUES (?)', ['Ada']);
$rows = Turso::query('SELECT * FROM users')->fetchArray(
\Darkterminal\TursoHttp\LibSQL::LIBSQL_ASSOC
);
$tx = Turso::transaction('deferred');
$tx->execute('INSERT INTO users (name) VALUES (?)', ['Grace']);
$tx->commit();Resolution details:
-
tursois a shared singleton —Turso::…, the service container (app('turso')), andLibSQL::class(autowired) all resolve to the sameDarkterminal\TursoHttp\LibSQLinstance. - The client is constructed from
config('turso-http').
docker/laravel-proof/ builds a fresh Laravel 12 application, installs
this package via a path repository, and asserts (verbatim from the harness):
PROOF-LARAVEL: {"ok":5,"fail":0,"all_ok":true,"checks":{"service_provider_registered":true,"facade_resolves":true,"version_non_empty":true,"facade_round_trip":true,"transaction_committed":true}}
This harness is green on PHP 8.3, 8.4 and 8.5:
docker/laravel-proof/proof.sh # 8.3 8.4 8.5
docker/laravel-proof/proof.sh 8.4 # single versionUse the plain client: Basic Usage. A Doctrine DBAL driver is a
separate package (turso-doctrine-dbal), as is the native-extension Laravel
driver (turso-driver-laravel) — this package is the HTTP client either can
stand in for.