Skip to content

Installation

Muhammet Şafak edited this page May 24, 2026 · 1 revision

Installation

Requirements

Requirement Minimum Notes
PHP 8.0 8.0 – 8.4 are tested in CI.
ext-pdo bundled Always required.
Driver ext. one of the below Choose based on the database you target.
Database PHP extension Tested
MySQL / MariaDB pdo_mysql
PostgreSQL pdo_pgsql
SQLite pdo_sqlite
Anything else PDO knows about the matching pdo_* extension not part of CI, but supported through the generic DSN code path

The psr/log package is suggested, not required — install it when you want to pass a real PSR-3 logger as the log credential.

Composer

composer require initorm/dbal

Lock to a specific major to avoid surprises:

composer require initorm/dbal:^2.0

The autoload entries are:

{
  "psr-4": {
    "InitORM\\DBAL\\Connection\\": "src/Connection/",
    "InitORM\\DBAL\\DataMapper\\": "src/DataMapper/"
  }
}

No manual require calls are needed — once Composer's autoloader is included, every class is discoverable.

Smoke test

<?php
require __DIR__ . '/vendor/autoload.php';

use InitORM\DBAL\Connection\Connection;

$db = new Connection([
    'driver'   => 'sqlite',
    'database' => ':memory:',
    'charset'  => '',
]);

var_dump($db->query('SELECT 1 AS one')->asAssoc()->row());
// array(1) { ["one"] => int(1) }

If the array prints, you are ready to move on to Getting Started.

Verifying the install

DBAL itself comes with a PHPUnit suite that you can run after cloning the repository:

git clone https://github.com/InitORM/DBAL.git
cd DBAL
composer install
composer test

The suite finishes in well under a second against SQLite in-memory.

Continuous Integration

The package ships two GitHub Actions workflows:

  • phpunit.yml — PHP 8.0 / 8.1 / 8.2 / 8.3 / 8.4 matrix; 8.3 also generates an xdebug coverage report and uploads it as an artifact.
  • composer-validate.yml — runs composer validate --strict on every PR that touches composer.json or composer.lock.

If you fork the repo, both workflows pick up automatically.

Clone this wiki locally