PHPackages                             tursodatabase/turso-doctrine-dbal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. tursodatabase/turso-doctrine-dbal

ActiveLibrary[Database &amp; ORM](/categories/database)

tursodatabase/turso-doctrine-dbal
=================================

A Doctribe DBAL Driver implementation on top of LibSQL Extension

1.2.1(1y ago)91192MITPHPPHP &gt;=8.1

Since Jun 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/tursodatabase/turso-doctrine-dbal)[ Packagist](https://packagist.org/packages/tursodatabase/turso-doctrine-dbal)[ GitHub Sponsors](https://github.com/darkterminal)[ RSS](/packages/tursodatabase-turso-doctrine-dbal/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

 [ ![Turso + TypeScript](https://camo.githubusercontent.com/3e22c64aeb4da4c404a1d06735053bf3c1fff9104b5468c61c17371116ceefca/68747470733a2f2f692e696d6775722e636f6d2f723030396e32752e706e67)](https://github.com/darkterminal/turso-doctrine-dbal)

### Turso + Doctrine DBAL

[](#turso--doctrine-dbal)

 SQLite for Production. Powered by [libSQL](https://turso.tech/libsql) and [libSQL Extension](https://github.com/darkterminal/libsql-extension) for PHP.

 [**Turso**](https://turso.tech) · [**Quickstart**](https://docs.turso.tech/sdk/php/orm/doctrine-dbal) · [**Examples**](https://docs.turso.tech/sdk/php/orm/doctrine-dbal) · [**Docs**](https://docs.turso.tech/sdk/php/orm/doctrine-dbal) · [**Discord**](https://discord.com/invite/4B5D7hYwub) · [**Blog &amp; Tutorials**](https://blog.turso.tech/)

---

A LibSQL Driver for Doctrine DBAL
=================================

[](#a-libsql-driver-for-doctrine-dbal)

 [    ![Shows a black logo in light color mode and a white one in dark color mode.](https://camo.githubusercontent.com/1231973ca7d74462fee93f4c961bcd721ad05606533ba80fa84994344a26ba78/68747470733a2f2f692e696d6775722e636f6d2f764743433049342e706e67)  ](https://discord.gg/turso)

LibSQL is a fork of SQLite and this package is **\#1 LibSQL Driver** that run natively using LibSQL Native Extension/Driver/Whatever and support Doctrine DBAL.

Requirement
-----------

[](#requirement)

**Before using this package**, you need to install and configure **LibSQL Native Extension for PHP**. You can download from **[LibSQL Extension - Release](https://github.com/darkterminal/libsql-extension)**

1. 📦 Extract the archive
2. 🗃 Locate somewhere in your machine
3. 💽 Copy a relative path that address that extension/driver
4. 📂 Open `php.ini` search `;extension` if you using nano (ctrl+w) then searching for it
5. 📝 add in the next-line `extension=liblibsql_php.so` (in Linux) without `;` at the begining

Package Installation
--------------------

[](#package-installation)

```
composer require tursodatabase/turso-doctrine-dbal
```

Configuration
-------------

[](#configuration)

LibSQL has 4 types of connections to interact with the database: In-Memory Connection, Local Connection, Remote Connection, and Remote Replica Connection (Embedded Replica).

### In-Memory Connection

[](#in-memory-connection)

```
$params = [
    "url"               => ":memory:",
    'driverClass'       => \Turso\Doctrine\DBAL\Driver::class,
];
```

### Local Connection

[](#local-connection)

```
$params = [
    "url"               => "database.db",
    'driverClass'       => \Turso\Doctrine\DBAL\Driver::class,
];
```

If you want to create Remote Connection or Remote Replica (Embedded Replica) Connection, you will need an existing database to continue. If you don’t have one, **[create one](https://docs.turso.tech/quickstart)**.

Get the database URL:

```
turso db show --url
```

Get the database authentication token:

```
turso db tokens create
```

If you use `.env` file, assign credentials to the environment variables inside `.env`.

```
TURSO_DATABASE_URL=
TURSO_AUTH_TOKEN=
```

### Remote Connection

[](#remote-connection)

```
$params = [
    "auth_token"        => "",
    "sync_url"          => "",
    'driverClass'       => \Turso\Doctrine\DBAL\Driver::class,
];
```

### Remote Replica (Embedded Replica) Connection

[](#remote-replica-embedded-replica-connection)

```
$params = [
    "url"               => "database.db",
    "auth_token"        => "",
    "sync_url"          => "",
    "sync_interval"     => 5,    // Optional, default is: 5 in seconds
    "read_your_writes"  => true, // Optional, default is: true
    "encryption_key"    => "",   // Optional, default is: empty
    'driverClass'       => \Turso\Doctrine\DBAL\Driver::class,
];
```

Usage
-----

[](#usage)

```
use Doctrine\DBAL\DriverManager;

require_once __DIR__ . '/vendor/autoload.php';

$params = [
    "url"               => ":memory:",
    'driverClass'       => \Turso\Doctrine\DBAL\Driver::class,
];

$db = DriverManager::getConnection($params);

$createTable = "CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT,
    age INTEGER
)";
$db->executeStatement($createTable);

$insertUsers = executeQuery("SELECT * FROM users")->fetchAllAssociative();
var_dump($result);
$db->close();
```

---

Documentation
-------------

[](#documentation)

1. [Turso Quickstart](https://docs.turso.tech/quickstart) — Learn how create and connect your first database.
2. [SDK Quickstart](#) — Learn how to install and execute queries using the libSQL client.
3. [SDK Reference](#) — Dive deeper with the libSQL SDK reference and examples.

### What is Turso?

[](#what-is-turso)

[Turso](https://turso.tech) is a SQLite-compatible database built on [libSQL](https://docs.turso.tech/libsql), the Open Contribution fork of SQLite. It enables scaling to hundreds of thousands of databases per organization and supports replication to any location, including your own servers, for microsecond-latency access.

Learn more about what you can do with Turso:

- [Embedded Replicas](https://docs.turso.tech/features/embedded-replicas)
- [Platform API](https://docs.turso.tech/features/platform-api)
- [Data Edge](https://docs.turso.tech/features/data-edge)
- [Branching](https://docs.turso.tech/features/branching)
- [Point-in-Time Recovery](https://docs.turso.tech/features/point-in-time-recovery)
- [Scale to Zero](https://docs.turso.tech/features/scale-to-zero)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Total

4

Last Release

630d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/288af989397101047c997f2bf781eced7216f448b9c1e6ca926c6e66eef762aa?d=identicon)[darkterminal](/maintainers/darkterminal)

---

Top Contributors

[![darkterminal](https://avatars.githubusercontent.com/u/32319439?v=4)](https://github.com/darkterminal "darkterminal (14 commits)")

### Embed Badge

![Health badge](/badges/tursodatabase-turso-doctrine-dbal/health.svg)

```
[![Health](https://phpackages.com/badges/tursodatabase-turso-doctrine-dbal/health.svg)](https://phpackages.com/packages/tursodatabase-turso-doctrine-dbal)
```

###  Alternatives

[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M36](/packages/scienta-doctrine-json-functions)[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4485.3M4](/packages/martin-georgiev-postgresql-for-doctrine)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[worksome/foggy

Foggy is a tool for making database dumps with some data removed/changed.

26571.7k1](/packages/worksome-foggy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
