jardissupport/dbquery

Enterprise-Grade SQL Query Builder for PHP 8.2+ - MySQL, PostgreSQL, SQLite

Installs: 120

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/jardissupport/dbquery

1.0.0 2026-02-25 17:37 UTC

README

Build Status PHP Version License PHPStan Level PSR-4 PSR-12 Coverage

Part of the Jardis Ecosystem — A modular DDD framework for PHP

Enterprise-Grade SQL Query Builder for PHP 8.2+. Production-proven, type-safe, and truly database-agnostic. Write once, deploy anywhere: MySQL/MariaDB, PostgreSQL, and SQLite — including advanced features like JSON operations, window functions, and CTEs.

Features

  • True Database Independence — Switch between MySQL, PostgreSQL, SQLite without changing code
  • Window Functions — ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD with partitioning
  • Common Table Expressions — WITH and WITH RECURSIVE for hierarchical queries
  • JSON Operations — Database-agnostic JSON querying with automatic dialect translation
  • Conflict Handling — ON DUPLICATE KEY (MySQL), ON CONFLICT (PostgreSQL), OR IGNORE (SQLite)
  • Security by Design — Prepared statements are standard, not optional
  • PHPStan Level 8 — Highest static analysis level, full type safety

Installation

composer require jardissupport/dbquery

Quick Start

use JardisSupport\DbQuery\DbQuery;

$query = new DbQuery();
$query->select('id, name, email')
      ->from('users')
      ->where('age')->greater(18)
      ->and('status')->equals('active')
      ->orderBy('name', 'ASC')
      ->limit(10);

// Generate SQL for any dialect
$prepared = $query->sql('mysql', prepared: true);

echo $prepared->sql();          // SQL with placeholders
print_r($prepared->bindings()); // Values for prepared statement

Documentation

Full documentation, examples and API reference:

jardis.io/docs/support/dbquery

Jardis Ecosystem

This package is part of the Jardis Ecosystem — a collection of modular, high-quality PHP packages designed for Domain-Driven Design.

Category Packages
Core Kernel, Entity, Workflow
Support DotEnv, Cache, Logger, Messaging, DbConnection, DbQuery, DbSchema, Validation, Factory, ClassVersion
Generic Auth
Tools Builder, Migration, Faker

Explore all packages

License

This package is licensed under the PolyForm Noncommercial License 1.0.0.

For commercial use, see COMMERCIAL.md.

Jardis Ecosystem by Headgent Development