Skip to content


Blrf\Dbal\Config is a DBAL configuration and connection creator.

$config = new Config('driver://hostname/database?param=value');
// create connection
    function (Connection $db) {
        // work with connection


The easiest way to setup a new database connection is by using the Config construtor with $uri. Full Uri is passed on to the driver when creating new connection.

You can also use setter methods to create config

$config = new Config();
    ->setParams(['param' => 'value']);
echo $config->getUri(); // mysql://user:password@localhost:3306/database?param=value

Adding driver

You can easily register new driver by calling Config::addDriver(), which you then initiate using the registered `scheme˙.

Add driver
Config::addDriver('myDriver', '\\My\\Driver');
$config = new Config('myDriver://hostname/database?param=value');

Remove driver

You can also remove driver:

Replace mysql driver
Config::addDriver('mysql', '\\My\\Driver');
$config = new Config('myDriver://hostname/database?param=value');