Dbal 4: introducing Symfony Bundle

Dbal was from the beginning independent on any framework. Since version 1.0 until now it had not required any external dependency. Of course, you should have had the basic PHP extensions present for accessing the database, but no other dependency is needed.

From the start Dbal was providing a Nette DI extension that eased the integration. And it wasn’t just a DIC registration of few services, Dbal also provided Tracy panel and Bluescreen integration.

Tracy with Nextras Dbal’s panel

Today I am proud that I can announce Symfony support via Bundle; available directly in Nextras Dbal. Simply add NextrasDbalBundle and you app will get auto DI’ registration of Connection service and profiler toolbar support.

<?php
// config/bundles.php

return [
    // ...
    Nextras\Dbal\Bridges\SymfonyBundle\NextrasDbalBundle::class => ['all' => true],
];
# config/packages/nextras_dbal.yaml
nextras_dbal:
  driver: mysqli
  host: 127.0.0.1
  username: root
  password: root
  database: your_db

Suddenly, everything is ready, all you need to obtain Nextras\Dbal\IConnection instance. The instance is available under the interface name and identifier with connection name: nextras_dbal.default.connection.

Symfony toolbar with Nextras Dbal’s tab
Symfony profiler with Nextras Dbal’s section

As you may see from the screenshots, the functionality in both integrations is the same. But feel free to send some enhancements.