Turso Platform API · PHP SDK

Manage Turso Platform from PHP.

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.

  • PHP 8.3+
  • PSR-18 transport
  • 53 mapped operations
  • Pest + PHPStan level 6
platform.php
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');
53Mapped Platform API operations
12Resource classes + integrations
v2.xLatest release
—GitHub stars

Why this SDK

Platform automation, with PHP ergonomics.

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.

Resource-first API

Call $client->databases(), ->groups(), ->organizations(), and other resources instead of assembling endpoint strings in every service.

Predictable errors

HTTP failures map to specific exceptions: auth, not found, rate limit, server, transport, and validation. Credentials are never echoed in exception messages.

PSR-18 friendly

Use the default Curl transport or inject your own PSR-18 client. The builder keeps configuration immutable and explicit.

Coverage

Resources mapped to the Turso Platform contract.

The SDK tracks operation coverage against a pinned OpenAPI snapshot. Every mapped operation has a resource method and is documented in the manual.

Users & Auth

Validate tokens and inspect the current user profile. user(), auth().

Organizations

Read/update org settings, plans, invoices, subscription, and usage. organizations().

Members & Invites

Manage organization members and v2 invites with typed roles. members(), invites().

Databases

Create, inspect, configure, token-mint, rotate, and query usage/stats. databases().

Groups

Manage groups, locations, configuration, transfer, unarchive, and tokens. groups().

API Tokens

Personal and organization-scoped API token lifecycle. apiTokens(), organizationApiTokens().

Recovery & Audit

List/restore deleted databases/groups via v3 and inspect audit logs. recovery(), auditLogs().

Integrations

Standalone database upload and region resolver helpers with explicit safety checks. Integrations\*.

Install

Start with Composer.

Install the package, create a Platform API token, and build a client with the immutable builder.

  1. 1

    Install package

    Require darkterminal/turso-api-client-php in a PHP 8.3+ project.

  2. 2

    Configure token

    Use a Turso Platform API token. For v3 recovery, also provide withOrganizationId().

  3. 3

    Call resources

    Use typed resource methods. Handle SDK exceptions at application boundaries. See the user manual.

shell
$ 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';"

Need the full contract?

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.