mordilion / doctrine-connection-keeper
A library to keep the Doctrine DBAL connection alive
Installs: 8 023
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
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? ], ], ], ], ], ];