mittnett / dbal
A very simple database abstraction layer. Uses PDO under-the-hood and supports mysql/mariadb and postgres.
Installs: 45
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
pkg:composer/mittnett/dbal
Requires
- php: >=8.0.0 <9
- ext-pdo: *
Requires (Dev)
- phpstan/phpstan: ^0.12.64
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-latest
Suggests
- ext-pdo_mysql: For MySQL driver
- ext-pdo_pgsql: For Postgres driver
This package is auto-updated.
Last update: 2025-09-16 03:50:25 UTC
README
A very simple database abstraction layer. Uses PDO under-the-hood and supports mysql/mariadb and postgres.
Usage
Setup a connection:
<?php // MySQL: $db = new \HbLib\DBAL\DatabaseConnection(new PDO('mysql:host=localhost;dbname=app', 'app', 'secret'), new \HbLib\DBAL\Driver\MySQLDriver()); // Postgres: $db = new \HbLib\DBAL\DatabaseConnection(new PDO('pgsql:host=localhost;dbname=app', 'app', 'secret'), new \HbLib\DBAL\Driver\PostgresDriver());
One can use \HbLib\DBAL\LazyDatabaseConnection
which only creates the PDO connection when needed.