Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 555 Bytes

database-connection-dbal-module.md

File metadata and controls

21 lines (15 loc) · 555 Bytes

Database Connection (DBAL Module)

We can use Ecotone's Laravel integration to reuse Connections that are already defined in your Application.

Using DSN

If we don't have existing connection defined, we can make use of DSN directly

# Register Service in Provider

use Enqueue\Dbal\DbalConnectionFactory;
use Ecotone\Dbal\DbalConnection;

public function register()
{
     $this->app->singleton(DbalConnectionFactory::class, function () {
         return DbalConnection::fromDsn('pgsql://user:password@host:5432/db_name');
     });
}