mordilion / doctrine-connection-keeper
A library to keep the Doctrine DBAL connection alive
Package info
github.com/mordilion/DoctrineConnectionKeeper
pkg:composer/mordilion/doctrine-connection-keeper
v1.0.0
2022-03-16 12:55 UTC
Requires
- php: ^7.4 || ^8.0
- doctrine/dbal: ^2.11
Requires (Dev)
- vimeo/psalm: ^4.7
README
Keep the connection to your MySQL-Server alive!
If an error happens like "MySQL server has gone away", then it will retry the failed statement. If the error happens again after the maximum retry attempts, then it throws it.
Config Example
use \Mordilion\DoctrineConnectionKeeper\Doctrine\DBAL\Connection; return [ 'doctrine' => [ 'connection' => [ 'orm_default' => [ 'wrapperClass' => Connection::class, 'params' => [ 'driver' => 'pdo_mysql', 'host' => 'localhost', 'port' => '3307', 'user' => '***', 'password' => '***', 'dbname' => '***', 'charset' => 'UTF8', 'connection_keeper' => [ // settings for the connection keeper 'reconnect_attempts' => 3, // how often should it try to reconnect? 'refresh_on_exception' => true, // should it refresh the connection on an exception? ], ], ], ], ], ];