darkterminal/turso-http
A lightweight PHP and Laravel client for the Turso HTTP API. Run SQL queries against your Turso/libSQL databases over plain HTTP, with no native extensions or PDO drivers required. Simple configuration, clean results, and a great fit for serverless and edge deployments.
Architecture fit. darkterminal/turso-http is a thin PHP client for Turso's HTTP data API, wrapping the libSQL-over-HTTP contract in a Laravel-friendly package (service provider, config, facade-style ergonomics). For a TPM, the architectural value is narrow but real: it decouples the PHP application from the libSQL native extension and lets Laravel apps running in constrained runtimes (Vapor, Bref, shared hosting, CI jobs, or environments without libsql-php) talk to a Turso database using only curl/Guzzle. It is not a Laravel database driver — it does not replace Eloquent's connector, and it will not transparently route your models through Turso. This is a deliberate scope choice, and the assessment should treat it as a data-plane client, not as an ORM replacement.
Integration feasibility. Low mechanical friction: composer require darkterminal/turso-http, publish config, set TURSO_DATABASE_URL (or database name) and TURSO_AUTH_TOKEN in env, and start issuing queries. Because the transport is HTTPS, it works from any PHP 8 host and survives the kind of extension/toolchain problems that make pdo_*/libsql-php painful on serverless. That said, feasibility of installation is not feasibility of production usage — the package is a client, and the surrounding concerns (retries, request sizing, batching, typed results, auth rotation) must be added by the team.
Technical risk. Several distinct risks:
DB::table(...) semantics will be disappointed; teams expecting an RPC-style client will be satisfied.SELECT ... FOR UPDATE, or multi-round-trip isolation must be re-architected or avoided. This is a Turso-API constraint the package inherits, not one it creates — but it is the single biggest thing to validate before committing.Key questions to resolve before committing.
Stack fit. Best-fit scenarios: Laravel on Vapor/Bref/serverless functions; background jobs that touch Turso reference data; edge-adjacent read workloads (config, feature flags, catalog, geo data) that benefit from Turso's replica placement; internal tools and scripts. Poor-fit scenarios: primary OLTP database for an Eloquent-centric monolith; anything requiring interactive transactions, advisory locks, or DBAL-level driver integration. Position the package alongside — not in place of — the app's primary database.
Migration path. Treat this as a second data plane, not a replacement. A pragmatic path:
TursoGateway, ReferenceDataRepository) so no domain code imports Darkterminal\TursoHttp\* directly. This one decision is what converts the bus-factor risk from "blocker" to "annoyance."Compatibility. Verify PHP ^8.x, Laravel versions declared in composer.json, and Guzzle constraint alignment with the rest of the stack. Turso's HTTP API surface is the real compatibility boundary — pin the package, and add an integration test suite that hits a real Turso database on a schedule so protocol drift surfaces before releases do.
Sequencing. Week 1: spike, latency benchmark, transaction-parity check. Week 2: wrap behind an internal gateway, add retries with jitter, add structured logging with a Turso request ID propagated for support escalation. Week 3: pilot with a real read path behind a feature flag, with a tested cutover back to the primary DB. Week 4+: decide on expansion based on measured data, not on the pilot's demo performance.
Maintenance. Low ongoing code churn if the wrapper is thin; the real burden is dependency stewardship: tracking Turso API changes, Guzzle/PHP upgrades, and the package's own release cadence (which may be slow). Assign an owner to the internal gateway interface and to the composer.json constraint. Pin to an exact tag, vendor via Composer with a committed composer.lock, and pre-agree a fork policy: if the upstream is unmaintained for two consecutive quarters or a breaking Turso change lands, fork under the org's namespace and patch.
Support. No SLA, no paid support, GitHub issues only. Escalation therefore splits: package bugs → internal fork; protocol/DB issues → Turso support (paid tiers available) or community forums. Budget TPM time for triaging "is this the package or Turso?" reports — the wrapper's log correlation should make this one-click.
Scaling. The application tier scales horizontally as normal because the client is stateless; the constraint is per-request latency and Turso-side rate limits (per-database and per-plan). Design for aggregation: batch statements to amortize TLS negotiation and round trips, cache hot reference data in Laravel's cache (Redis/file/APCu), and avoid per-row loops. Under load, the failure mode is "the database is fine, the client is CPU/connection-bound" — so instrument outbound call volume per request, not just query duration.
Failure modes to design for.
Ramp-up. For a competent Laravel engineer, half a day to first query, one to two weeks to production-grade: retries, timeout tuning, batching strategy, observability, token handling, and the internal gateway abstraction. Document the transactional limitations up front — most of the ramp-up cost is unlearning PDO/Eloquent assumptions, not learning this package's API.
How can I help you explore Laravel packages today?