PHP code example of mordilion / doctrine-connection-keeper

1. Go to this page and download the library: Download mordilion/doctrine-connection-keeper 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/ */

    

mordilion / doctrine-connection-keeper example snippets


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?            
                    ],
                ],
            ],
        ],
    ],
];