efureev / swoole-doctrine-dbal-pgsql-driver
The Postgres Swoole 5 driver for Doctrine
Installs: 4 076
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 1
Open Issues: 0
Requires
- php: ^8.2
- doctrine/dbal: ^4.0
- symfony/contracts: ^3.2
- symfony/http-kernel: ^6.2|^7.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.28
- roave/security-advisories: dev-latest
- squizlabs/php_codesniffer: ^3.7.2
- symfony/dependency-injection: ^6.2|^7.0
- vimeo/psalm: ^5.8
- weirdan/doctrine-psalm-plugin: ^2.8
README
Doctrine DBAL Driver for Swoole 5 Postgresql database connections
Installation
The easiest way to install this package is through composer:
$ composer require efureev/swoole-doctrine-dbal-pgsql-driver
Example
You can test functionality using supplied docker image, located in example folder. Cli example can be found in example/cli.php. HTTP server example can be found in example/server.php
App Config:
doctrine: dbal: default_connection: 'swoole' connections: swoole: dbname: '%env(DB_MASTER_NAME)%' host: '%env(DB_MASTER_HOST)%' port: '%env(DB_MASTER_PORT)%' user: '%env(DB_MASTER_USER)%' password: '%env(DB_MASTER_PASS)%' driver_class: 'Swoole\Packages\Doctrine\DBAL\PgSQL\Driver' server_version: '15' options: poolSize: 3 # MAX count connections in one pool usedTimes: 3 # 1 connection (in pool) will be re-used maximum N queries connectionTTL: 60 # when connection not used this time(seconds) - it will be close (free) tickFrequency: 60000 # when need check possibilities downscale (close) opened connection to DB in pools connectionDelay: 2 # time(seconds) for waiting response from pool useConnectionPool: true # if false, will create new connect instead of using pool retryMaxAttempts: 2 # if connection in pool was timeout (before use) then try re-connect retryDelay: 1000 # delay to try fetch from pool again(milliseconds) if no connect available
Add Bundle to the bundles.php
:
[ SwooleDoctrineDbalPoolBundle::class => ['all' => true], ]
It's all.