xj/yii2-db-reconnect

yii2-db-auto-reconnect

1.0.0 2016-05-18 08:01 UTC

This package is auto-updated.

Last update: 2024-12-10 20:43:32 UTC


README

composer

"require": {
    "xj/yii2-db-reconnect": "~1.0"
},

config

'db' => [
//    'class' => 'yii\db\Connection',
    'class' => 'xj\dbreconnect\mysql\Connection', //add
    'reconnectMaxCount' => 2,
    //normal
    'dsn' => 'mysql:host=127.0.0.1;dbname=test',
    'username' => 'root',
    'password' => '',
    'charset' => 'utf8',
],

log

'log' => [
    'targets' => [
        [
            'class' => 'yii\log\FileTarget',
            'levels' => ['error', 'info'],
            'maxLogFiles' => 20,
            'maxFileSize' => 2048,
            'categories' => [
                'xj\dbreconnect\*',
            ],
            'logFile' => '@frontend/runtime/logs/dbreconnect.log',
        ],
    ],
],