PHPackages                             cooldogedev/libsql - 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. cooldogedev/libsql

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

cooldogedev/libsql
==================

A minimalistic implementation of asynchronous SQL

v0.2.6(2y ago)231016MITPHP

Since May 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/cooldogepm/libSQL)[ Packagist](https://packagist.org/packages/cooldogedev/libsql)[ RSS](/packages/cooldogedev-libsql/feed)WikiDiscussions pm5 Synced 1w ago

READMEChangelog (1)DependenciesVersions (5)Used By (0)

libSQL
======

[](#libsql)

A minimalistic implementation of asynchronous [SQL](https://en.wikipedia.org/wiki/SQL) for PHP.

### Usage

[](#usage)

#### Initialise the connection pool

[](#initialise-the-connection-pool)

```
$pool = new ConnectionPool(PluginBase, [
    "provider" => "sqlite",
    "threads" => 2,
    "sqlite" => [
        "path" => "test.db"
    ]
]);
```

#### Examples

[](#examples)

###### Retrieve all customer records

[](#retrieve-all-customer-records)

- Create the query class

```
final class CustomerRetrievalQuery extends SQLiteQuery {
    public function onRun(SQLite3 $connection): void {
        $this->setResult($connection->query($this->getQuery())?->fetchArray() ?: []);
    }

    public function getQuery(): string { return "SELECT * FROM customers"; }
}
```

- Execute the query

```
$query = new CustomerRetrievalQuery();
$query->execute(
    onSuccess: function (array $customers): void {
        foreach ($customers as $customer) {
            echo $customer["name"] . " " . $customer["lastName"] . ": " . $customer["age"];
            echo PHP_EOL;
        }
    },
    onFailure: function (SQLException $exception): void {
        echo "Failed to retrieve customers due to: " . $exception->getMessage();
    }
);
```

###### Create a new customer record

[](#create-a-new-customer-record)

- Create the query class

```
final class CustomerCreationQuery extends SQLiteQuery {
    public function __construct(
        protected string $name,
        protected string $lastName,
        protected int    $age
    ) {}

    public function onRun(SQLite3 $connection): bool {
        $statement = $connection->prepare($this->getQuery());

        $statement->bindValue(":name", $this->getName());
        $statement->bindValue(":lastName", $this->getLastName());
        $statement->bindValue(":age", $this->getAge());
        $statement->execute();

        $this->setResult($connection->changes() > 0);

        $statement->close();
    }

    public function getQuery(): string {
        return "INSERT OR IGNORE INTO customers (name, lastName, age) VALUES (:name, :lastName, :age)";
    }

    public function getName(): string { return $this->name; }
    public function getLastName(): string { return $this->lastName; }
    public function getAge(): int { return $this->age; }
}
```

- Execute the query

```
$query = new CustomerCreationQuery("Saul", "Goodman", 41);
$pool->submit(
    query: $query,

    onSuccess: function (bool $created): void {
        echo $created ? "Customer created successfully!" : "Customer already exists!";
    },
    onFailure: function (SQLException $exception): void {
        echo "Failed to create the record due to: " . $exception->getMessage();
    }
);
```

### Projects using libSQL

[](#projects-using-libsql)

- [BedrockEconomy](https://github.com/cooldogepm/BedrockEconomy)
- [BuildBattle](https://github.com/cooldogepm/BuildBattle)
- [TheBridges](https://github.com/cooldogepm/TheBridges)
- [TNTTag](https://github.com/cooldogepm/TNTTag)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% 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 ~48 days

Total

3

Last Release

848d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e0d799286b3631a904a46787585756c62c4fad6d9178dae4c73b4e8fb08884d9?d=identicon)[cooldogedev](/maintainers/cooldogedev)

---

Top Contributors

[![cooldogedev](https://avatars.githubusercontent.com/u/84240659?v=4)](https://github.com/cooldogedev "cooldogedev (24 commits)")[![fadheldev](https://avatars.githubusercontent.com/u/77399231?v=4)](https://github.com/fadheldev "fadheldev (9 commits)")[![DaisukeDaisuke](https://avatars.githubusercontent.com/u/17798680?v=4)](https://github.com/DaisukeDaisuke "DaisukeDaisuke (1 commits)")[![JavierLeon9966](https://avatars.githubusercontent.com/u/58715544?v=4)](https://github.com/JavierLeon9966 "JavierLeon9966 (1 commits)")[![poggit-bot](https://avatars.githubusercontent.com/u/22427965?v=4)](https://github.com/poggit-bot "poggit-bot (1 commits)")

---

Tags

asynchronouslibrarymysqlphpsqlsqlitethreading

### Embed Badge

![Health badge](/badges/cooldogedev-libsql/health.svg)

```
[![Health](https://phpackages.com/badges/cooldogedev-libsql/health.svg)](https://phpackages.com/packages/cooldogedev-libsql)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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