PHP code example of efureev / swoole-doctrine-dbal-pgsql-driver
1. Go to this page and download the library: Download efureev/swoole-doctrine-dbal-pgsql-driver library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
efureev / swoole-doctrine-dbal-pgsql-driver example snippets
// config/bundles.php
SwooleDoctrinePool\Bridge\Symfony\SwooleDoctrinePoolBundle::class => ['all' => true],
$registry = new PoolRegistry(logger: $logger); // one per worker
$config = new Configuration();
$config->setMiddlewares([new PoolDriverMiddleware($registry)]);
$connection = DriverManager::getConnection([
'driverClass' => SwooleDoctrinePool\Driver\Driver::class,
'wrapperClass' => SwooleDoctrinePool\DBAL\CoroutineSafeConnection::class,
'host' => '127.0.0.1', 'dbname' => 'app', 'user' => 'app', 'password' => 'secret',
'serverVersion' => '17',
'driverOptions' => ['pool' => ['size' => 20]],
], $config);
$server->on('workerStop', static fn() => $registry->closeAll());