PHPackages                             hiblaphp/pdo-query-builder - 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. hiblaphp/pdo-query-builder

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

hiblaphp/pdo-query-builder
==========================

Framework Agnostic Asynchonous Query Builder

410PHPCI passing

Since Oct 24Pushed 1w agoCompare

[ Source](https://github.com/hiblaphp/query-builder)[ Packagist](https://packagist.org/packages/hiblaphp/pdo-query-builder)[ RSS](/packages/hiblaphp-pdo-query-builder/feed)WikiDiscussions main Synced 4mo ago

READMEChangelog (4)DependenciesVersions (2)Used By (0)

Hibla Query Builder
===================

[](#hibla-query-builder)

**A framework-agnostic, async-first query builder and connection pool manager for PHP 8.4+.**

> **Note:** This repository is the core query engine of the [Hibla Database Ecosystem](https://github.com/hiblaphp/database). For complete, comprehensive documentation covering Migrations, Seeders, and advanced Query Builder features, please visit the main **[hiblaphp/database meta-package](https://github.com/hiblaphp/database)**.

Overview
--------

[](#overview)

`hiblaphp/query-builder` provides high-performance, non-blocking database access for modern async PHP applications. It brings the familiar, highly-expressive fluent syntax of Laravel's query builder to asynchronous runtimes.

### Supported Drivers &amp; Async Strategy

[](#supported-drivers--async-strategy)

Rather than relying on blocking PDO drivers, Hibla utilizes tailored non-blocking drivers optimized for each database engine:

- **SQLite** (Default): Achieved via a process-isolated async worker daemon pool (`hiblaphp/sqlite`), allowing asynchronous, non-blocking file access.
- **MySQL &amp; MariaDB**: Achieved via a pure PHP async socket implementation of the MySQL binary protocol (`hiblaphp/mysql`).
- **PostgreSQL**: Achieved via native non-blocking socket-polling libpq drivers (`hiblaphp/postgres`).

Features
--------

[](#features)

- **Native Connection Pooling**: Fully-managed connection pooling for all drivers (including subprocess pooling for SQLite).
- **Zero-Config Default**: Defaulting to SQLite means your application can run immediately out-of-the-box with no external database server needed.
- **Unbuffered Streaming**: Stream massive datasets row-by-row with automatic backpressure handling.
- **Common Table Expressions**: Programmatic CTE support, including recursive sequences.
- **Database-Specific Polyfills**: Dialect-specific support for JSON extraction, Pessimistic Locking (`lockForUpdate`), and Upserts across all supported engines.
- **Immutable Query Building**: Abstract Syntax Trees (ASTs) are safely cloned on every modification, preventing query state from leaking across operations.

Installation
------------

[](#installation)

> This package is currently in **beta**. Before installing, ensure your `composer.json`allows beta releases:

Install the package via Composer:

```
composer require hiblaphp/query-builder
```

Initialize your database configuration file:

```
cp vendor/hiblaphp/query-builder/hibla-database.php hibla-database.php
```

*(Edit `hibla-database.php` or your `.env` file to select your default connection).*

Quick Start (Zero-Config SQLite)
--------------------------------

[](#quick-start-zero-config-sqlite)

Because the library defaults to an in-memory SQLite database, you can run queries immediately without configuring any external database servers:

```
