Resource-first API
Call $client->databases(), ->groups(), ->organizations(), and other resources instead of assembling endpoint strings in every service.
Turso Platform API · PHP SDK
A typed, resource-first SDK for the Turso Platform API. Build automation around organizations, databases, groups, tokens, audit logs, recovery, and upload workflows without hand-writing raw HTTP calls.
use Darkterminal\TursoPlatformAPI\Client\Client;
$client = Client::builder()
->withToken($_ENV['TURSO_PLATFORM_API_TOKEN'])
->withOrganization('acme')
->build();
$dbs = $client->databases()->list();
$group = $client->groups()->create('app', 'aws-us-east-1');
$token = $client->databases()->createToken('app-db');
Why this SDK
The SDK wraps the Turso Platform API contract into a small, typed client. It keeps HTTP details predictable while preserving raw response payloads for forward compatibility.
Call $client->databases(), ->groups(), ->organizations(), and other resources instead of assembling endpoint strings in every service.
HTTP failures map to specific exceptions: auth, not found, rate limit, server, transport, and validation. Credentials are never echoed in exception messages.
Use the default Curl transport or inject your own PSR-18 client. The builder keeps configuration immutable and explicit.
Coverage
The SDK tracks operation coverage against a pinned OpenAPI snapshot. Every mapped operation has a resource method and is documented in the manual.
Validate tokens and inspect the current user profile. user(), auth().
Read/update org settings, plans, invoices, subscription, and usage. organizations().
Manage organization members and v2 invites with typed roles. members(), invites().
Create, inspect, configure, token-mint, rotate, and query usage/stats. databases().
Manage groups, locations, configuration, transfer, unarchive, and tokens. groups().
Personal and organization-scoped API token lifecycle. apiTokens(), organizationApiTokens().
List/restore deleted databases/groups via v3 and inspect audit logs. recovery(), auditLogs().
Standalone database upload and region resolver helpers with explicit safety checks. Integrations\*.
Install
Install the package, create a Platform API token, and build a client with the immutable builder.
Require darkterminal/turso-api-client-php in a PHP 8.3+ project.
Use a Turso Platform API token. For v3 recovery, also provide withOrganizationId().
Use typed resource methods. Handle SDK exceptions at application boundaries. See the user manual.
$ composer require darkterminal/turso-api-client-php
# .env
$ export TURSO_PLATFORM_API_TOKEN=...
# verify
$ php -r "require 'vendor/autoload.php'; echo class_exists(Darkterminal\\TursoPlatformAPI\\Client\\Client::class)?'ok':'missing';"
The user manual covers configuration, every resource, request/response shapes, enums, exceptions, recovery quirks, upload preflight checks, and troubleshooting from real CI/live-proof fixes.