PHPackages                             brash/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. brash/dbal

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

brash/dbal
==========

An Async Database Abstract Layer based on Doctrine DBAL

v1.0.0(1y ago)448MITPHPPHP ^8.3.0CI passing

Since Dec 31Pushed 1y ago2 watchersCompare

[ Source](https://github.com/BrashPHP/dbal)[ Packagist](https://packagist.org/packages/brash/dbal)[ Fund](https://www.paypal.com/paypalme/enunomaduro)[ GitHub Sponsors](https://github.com/nunomaduro)[ RSS](/packages/brash-dbal/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (3)Used By (0)

Brash DBAL
==========

[](#brash-dbal)

---

This is a DBAL on top of ReactPHP SQL clients and Doctrine DBAL. With this, you will be able to use

```
Doctrine QueryBuilder model
Doctrine Schema model
SQL Statements
Easy-to-use shortcuts for common operations

```

Using this non-blocking approach, you release your processes from the burden of keeping await operations while you can take the most out of your processor, with the advantage of seemingly unnoticeable `await` keywords.

How to use
----------

[](#how-to-use)

You may find concrete examples (and working!) in `examples` directory, but this package does pretty much what Doctrine DBAL does, since it is just a way to extend Doctrine DBAL's already useful and knwon qualities. The additions are transparent, but basically:

- A connection pool
- Async drivers
- A custom Driver Manager

It goes like this ;)

```
use Brash\Dbal\DriverManager;

$connectionParams = [
    'dbname' => 'mydb',
    'user' => 'root',
    'password' => 'secret',
    'host' => 'localhost',
    'driver' => 'async_mysql', # pay attention to the driver selection!
    'port' => 3306
];

$conn = DriverManager::getConnection($connectionParams);
$conn->insert("test", [
    'id' => 1,
    'username' => "Gabo Bertir"
]);
```

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

[](#configuration)

You can configure the driver manager directly from the class just like the connection pool values.

```
use Brash\Dbal\DriverManager;

DriverManager::setPoolOptions(new ConnectionPoolOptions(
    maxConnections: 10,
    idleTimeout: 2, # in seconds
    maxRetries: 5,
    discardIdleConnectionsIn: 5, # seconds
    minConnections: 2,
    keepAliveIntervalSec: 0 # Disabled when 0
));

DriverManager::getConnection([...]);
```

Driver Options
--------------

[](#driver-options)

Choose between MySQL, MariaDB, Postgres and SQLite, just passing the correct driver in your `Connection Params`.

```
    'async_postgres' => AsyncPostgresDriver::class,
    'async_mysql' => AsyncMysqlDriver::class,
    'async_sqlite' => AsyncSqliteDriver::class,
```

Under the hood
--------------

[](#under-the-hood)

Internally, the: Postgres Async Driver is an implementation on top of Voryx/PgAsync; SQLite Async Driver is an implementation on top of Clue/reactphp-sqlite, and MySQL/MariaDB is an implementation on top of react/mysql.

> **Requires [PHP 8.3+](https://php.net/releases/)**

🧹 Keep a modern codebase with **Pint**:

```
composer lint
```

✅ Run refactors using **Rector**

```
composer refacto
```

⚗️ Run static analysis using **PHPStan**:

```
composer test:types
```

✅ Run unit tests using **PEST**

```
composer test:unit
```

🚀 Run the entire test suite:

```
composer test
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance40

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.9% 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

Unknown

Total

1

Last Release

499d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2754bf7a9174f2abafce9571a9d87dc2e705c284aedbe227cab3e3f85c9bfb61?d=identicon)[Gabriel Berthier](/maintainers/Gabriel%20Berthier)

---

Top Contributors

[![nunomaduro](https://avatars.githubusercontent.com/u/5457236?v=4)](https://github.com/nunomaduro "nunomaduro (80 commits)")[![jayan-blutui](https://avatars.githubusercontent.com/u/30396013?v=4)](https://github.com/jayan-blutui "jayan-blutui (3 commits)")[![gabrielberthier](https://avatars.githubusercontent.com/u/40048106?v=4)](https://github.com/gabrielberthier "gabrielberthier (3 commits)")[![svenluijten](https://avatars.githubusercontent.com/u/11269635?v=4)](https://github.com/svenluijten "svenluijten (1 commits)")[![askdkc](https://avatars.githubusercontent.com/u/7894265?v=4)](https://github.com/askdkc "askdkc (1 commits)")[![Synchro](https://avatars.githubusercontent.com/u/81561?v=4)](https://github.com/Synchro "Synchro (1 commits)")[![dansysanalyst](https://avatars.githubusercontent.com/u/79267265?v=4)](https://github.com/dansysanalyst "dansysanalyst (1 commits)")[![juse-less](https://avatars.githubusercontent.com/u/76173223?v=4)](https://github.com/juse-less "juse-less (1 commits)")

---

Tags

phpasyncpackagedbalreactphp

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/brash-dbal/health.svg)

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

###  Alternatives

[clue/redis-react

Async Redis client implementation, built on top of ReactPHP.

28210.5M45](/packages/clue-redis-react)[react/mysql

Async MySQL database client for ReactPHP.

340421.0k29](/packages/react-mysql)[awssat/laravel-sync-migration

Laravel tool helps to sync migrations without refreshing the database

10923.2k](/packages/awssat-laravel-sync-migration)[clue/reactphp-sqlite

Async SQLite database, lightweight non-blocking process wrapper around file-based database extension (ext-sqlite3), built on top of ReactPHP.

5738.3k19](/packages/clue-reactphp-sqlite)[jawira/db-draw

📐 Takes a DoctrineORM connection and generates a database diagram in .puml format

2295.1k2](/packages/jawira-db-draw)[shuchkin/react-smtp-client

ReactPHP async SMTP Client

245.7k](/packages/shuchkin-react-smtp-client)

PHPackages © 2026

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