Prerequisites

Before you start, make sure you:

Download the latest build extension/driver binary you can see at Release page. It's available for:

Now, LibSQL class is available in your PHP environment! You can use it everywhere in your PHP project 🎉

1

Configure database credentials

Get the database URL:

turso db show --url <database-name>

Get the database authentication token:

turso db tokens create <database-name>

Assign credentials to the environment variables inside .env.

TURSO_DATABASE_URL=
TURSO_AUTH_TOKEN=
Save this later when you need to connect to Remote and Embedded Replica
2

Create PHP Project

Create new directory:

mkdir your-awesome-php-project
cd your-awesome-php-project
3

Install Turso Doctrine DBAL

composer require tursodatabase/turso-doctrine-dbal
4

Configure database connection

Setup the environment variable in your Laravel application, choose what the type connection you need.

Other environment variables (Embedded Replica Only)

5

Project Structure Example

src/
├── helpers.php
└── Todo.php
vendor/
composer.json
composer.lock
todo            # todo executable

Here you simple php todo cli + Doctrine BDAL

6

Your PHP Application Ready!

Examples