- Turso Client PHP or install using Turso PHP Installer
- libSQL Multi Tenant Database - Local File Connection ✅
- libSQL Multi Tenant Database - Remote Connection ✅
- libSQL Multi Tenant Database - Multi-DB Schemas (Only work with Remote Connection) ✅
Commands | Local | Remote | Multi-DB Schema |
---|---|---|---|
tenants:list | ✅ | ✅ | ✅ |
tenants:migrate | ✅ | ✅ | ❌ |
tenants:migrate-fresh | ✅ | ✅ | ❌ |
tenants:rollback | ✅ | ✅ | ❌ |
tenants:run | ✅ | ✅ | ❌ |
tenants:seed | ✅ | ✅ | ❌ |
DB_CONNECTION=libsql
DB_DATABASE=database.sqlite
- Create new database
turso db create <your-db-name>
- Get database URL and add to
DB_SYNC_URL
turso db show <your-db-name>
Name: <your-db-name>
URL: libsql://<your-db-name>-<your-organization-name>.turso.io
ID: *******-****-****-****-************
Group: <your-group-name>
Version: *.**.**
Locations: ***
Size: *** kB
Archived: No
Bytes Synced: 0 B
Is Schema: No
Database Instances:
NAME TYPE LOCATION
*** primary ***
- Create database auth token and add to
DB_AUTH_TOKEN
turso db tokens create <your-db-name>
- Create Platform API Token and add to
TURSO_API_TOKEN
turso auth api-tokens mint <your-app-name> # named whatever you want
Setting up your Environment Variables
DB_CONNECTION=libsql
DB_AUTH_TOKEN=<your-database-auth-token>
DB_SYNC_URL=<your-database-url>
DB_REMOTE_ONLY=true
TURSO_API_TOKEN=<your-platform-api-token>
TURSO_DB_PRIMARY_NAME=<your-db-name>
TURSO_DB_PRIMARY_ORG=<your-organization-name>
TURSO_DB_DEFAULT_GROUP=<your-group-name>
- Create new database
turso db create <your-db-name> --type schema
- Get database URL and add to
DB_SYNC_URL
turso db show <your-db-name>
Name: <your-db-name>
URL: libsql://<your-db-name>-<your-organization-name>.turso.io
ID: *******-****-****-****-************
Group: <your-group-name>
Version: *.**.**
Locations: ***
Size: *** kB
Archived: No
Bytes Synced: 0 B
Is Schema: Yes
Database Instances:
NAME TYPE LOCATION
*** primary ***
- Create group auth token and add to
DB_AUTH_TOKEN
turso db group tokens create <your-group-name>
- Create Platform API Token and add to
TURSO_API_TOKEN
turso auth api-tokens mint <your-app-name> # named whatever you want
Setting up your Environment Variables
DB_CONNECTION=libsql
DB_AUTH_TOKEN=<your-group-auth-token>
DB_SYNC_URL=<your-database-url>
DB_REMOTE_ONLY=true
TURSO_API_TOKEN=<your-platform-api-token>
TURSO_DB_PRIMARY_NAME=<your-db-name>
TURSO_DB_PRIMARY_ORG=<your-organization-name>
TURSO_DB_DEFAULT_GROUP=<your-group-name>
TURSO_MULTIDB_SCHEMA=true