Download the PHP package infocyph/dblayer without Composer
On this page you can find all versions of the php package infocyph/dblayer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download infocyph/dblayer
More information about infocyph/dblayer
Files in infocyph/dblayer
Package dblayer
Short Description High-performance, secure database layer for PHP and multi-driver capabilities
License MIT
Informations about the package dblayer
DBLayer - High-Performance PHP Database Layer
A robust, secure, and feature-rich database abstraction layer for PHP 8.4+ with multi-driver compatibility.
Features
Core Features
- Query Builder - Fluent, Laravel-like API
- Repository Layer - Thin class-based repositories on top of Query Builder
- Connection Manager - Connection pooling + read replicas
- Replica Strategies -
random,round_robin,least_latency - Multi-Driver - MySQL, PostgreSQL, SQLite
- Security - Multi-layer SQL injection protection
- Transactions - Nested transactions with savepoints
- Caching - Query result caching
- Profiling - Performance monitoring
- Events - Lifecycle hooks
- Telemetry - Query + transaction observability export
- Pagination - Length-aware, simple, and cursor pagination
Performance
- Microsecond-level benchmark results for core query-builder and transaction paths
- Connection pooling for reuse
- Memory-efficient cursor mode for large datasets
Security
- Automatic parameterization (all values bound)
- Identifier validation & escaping
- Operator whitelist
- SQL injection pattern detection
- Config-driven hardening with TLS policy controls
- Rate limiting
- Audit logging
Installation
Quick Start
Basic Configuration
Query Controls
Telemetry
Query Builder
Repository Layer
Choosing APIs (DB vs QueryBuilder vs Repository)
- Use
DBfor infrastructure concerns: connections, transactions, retries, telemetry, pooling. - Use
DB::table()/QueryBuilderfor ad-hoc SQL shaping: joins, CTEs, dynamic filters, reporting. - Use
DB::repository()for reusable table-level rules: tenant scope, soft deletes, optimistic locking, hooks, casts.
If the same table rules appear in multiple call sites, move that logic into a repository-oriented class.
TableRepository (Repository-Oriented, Non-ORM)
Transactions
Testing
Test execution is driver-aware:
- SQLite-only environments run the base test set.
- If MySQL/PostgreSQL are available (via
DBLAYER_MYSQL_*/DBLAYER_PGSQL_*env vars), matrix tests automatically run for those drivers too.
So total test count increases when more drivers are available.
Benchmarking
Benchmarks
Latest composer bench:quick sample output:
| Subject | Mode | RSD |
|---|---|---|
benchBuildSelectSql |
11.79μs |
±0.80% |
benchSelectByPrimaryKey |
28.20μs |
±1.27% |
benchTransactionTwoPointReads |
20.66μs |
±1.61% |
benchUpdateSingleColumn |
23.45μs |
±4.21% |
Environment for this sample: PHP 8.5.4, xdebug disabled, opcache disabled, 10 revs x 3 iterations.
Security
DBLayer implements multiple layers of security:
- Parameterization - All values automatically bound
- Identifier Validation - Table/column names validated
- Operator Whitelist - Only safe operators allowed
- Injection Detection - Scans for suspicious patterns
- Rate Limiting - Prevents query flooding
- Audit Logging - Tracks all queries
Hardening controls:
DB::hardenProduction()setsenabled=true,strict_identifiers=true,require_tls=true.SecurityMode::OFFis blocked by default (allow explicitly withSecurity::allowInsecureMode(true)).security.enabled=falseandsecurity.require_tls=falserequiresecurity.allow_insecure=true.
Requirements
- PHP 8.4+
- ext-pdo
- ext-pdo_mysql (for MySQL)
- ext-pdo_pgsql (for PostgreSQL)
- ext-pdo_sqlite (for SQLite)
Security
Protected by PHPForge — an automated quality and security gate for PHP projects.
MIT Licensed
Documentation • Security • Code of Conduct • Contributing • Report Bug • Request Feature
All versions of dblayer with dependencies
ext-pdo Version *
infocyph/arraykit Version ^4.1
infocyph/cachelayer Version ^1.2
psr/log Version ^3.0