PHPackages                             vanam/kdyby-doctrine-mysql-come-back - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. vanam/kdyby-doctrine-mysql-come-back

ActiveLibrary[Database &amp; ORM](/categories/database)

vanam/kdyby-doctrine-mysql-come-back
====================================

Auto reconnect on Doctrine MySql has gone away exceptions on doctrine/dbal with Kdyby/Doctrine compatibility. This is a fork of https://github.com/facile-it/doctrine-mysql-come-back

010PHP

Since Sep 23Pushed 10y ago1 watchersCompare

[ Source](https://github.com/vanam/kdyby-doctrine-mysql-come-back)[ Packagist](https://packagist.org/packages/vanam/kdyby-doctrine-mysql-come-back)[ RSS](/packages/vanam-kdyby-doctrine-mysql-come-back/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

KdybyDoctrineMySQLComeBack
==========================

[](#kdybydoctrinemysqlcomeback)

Auto reconnect on Doctrine MySql has gone away exceptions on doctrine/dbal &gt;=2.3,&lt;2.6-dev with Kdyby/Connection extension.

Installation
============

[](#installation)

```
$ composer require vanam/kdyby-doctrine-mysql-come-back dev-master
```

Configuration
=============

[](#configuration)

In order to use KdybyDoctrineMySQLComeBack you have to set `wrapperClass` and `driverClass` connection params. You can choose how many times Doctrine should be able to reconnect, setting `x_reconnect_attempts` driver option. Its value should be an int.

An example of configuration at connection instantiation time:

```
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\DriverManager;

$config = new Configuration();

//..

$connectionParams = array(
    'dbname' => 'mydb',
    'user' => 'user',
    'password' => 'secret',
    'host' => 'localhost',
    // [doctrine-mysql-come-back] settings
    'wrapperClass' => 'Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection',
    'driverClass' => 'Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Driver\PDOMySql\Driver',
    'driverOptions' => array(
        'x_reconnect_attempts' => 3
    )
);

$conn = DriverManager::getConnection($connectionParams, $config);

//..
```

An example of neon configuration on Nette projects:

```
# config.neon

doctrine:
    driverClass: Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Driver\PDOMySql\Driver
    wrapperClass: Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection
    host: %database.host%
    user: %database.user%
    password: %database.password%
    dbname: %database.dbname%
    driverOptions:
        x_reconnect_attempts: 3
    metadata:
        App: %appDir% # namespace with models in Nette app
```

An example of yaml configuration on Symfony 2 projects:

```
# Doctrine example Configuration
doctrine:
    dbal:
        default_connection: %connection_name%
        connections:
            %connection_name%:
                host:     %database_host%
                port:     %database_port%
                dbname:   %database_name%
                user:     %database_user%
                password: %database_password%
                charset:  UTF8
                wrapper_class: 'Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection'
                driver_class: 'Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Driver\PDOMySql\Driver'
                options:
                    x_reconnect_attempts: 3
```

Usage
=====

[](#usage)

To force a reconnection try after a long running task you can call

```
$em->getConnection()->refresh();
```

before performing any other operation different from SELECT.

Instead, in case your next query will be a SELECT, reconnection will be automagically done.

Thanks
======

[](#thanks)

Thanks to Dieter Peeters and his proposal on [DBAL-275](http://www.doctrine-project.org/jira/browse/DBAL-275). Check it out if you are using doctrine/dbal &lt;2.3.

###  Health Score

21

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9176cbb4c4a4dc0c7e4f58d432ae4c50ec3039ab16b0b42ac8938d33a938b552?d=identicon)[vanam](/maintainers/vanam)

---

Top Contributors

[![peelandsee](https://avatars.githubusercontent.com/u/1212677?v=4)](https://github.com/peelandsee "peelandsee (14 commits)")[![vanam](https://avatars.githubusercontent.com/u/2945739?v=4)](https://github.com/vanam "vanam (4 commits)")[![maxcanna](https://avatars.githubusercontent.com/u/1881831?v=4)](https://github.com/maxcanna "maxcanna (2 commits)")[![Jean85](https://avatars.githubusercontent.com/u/6729988?v=4)](https://github.com/Jean85 "Jean85 (1 commits)")[![thomasvargiu](https://avatars.githubusercontent.com/u/732012?v=4)](https://github.com/thomasvargiu "thomasvargiu (1 commits)")

### Embed Badge

![Health badge](/badges/vanam-kdyby-doctrine-mysql-come-back/health.svg)

```
[![Health](https://phpackages.com/badges/vanam-kdyby-doctrine-mysql-come-back/health.svg)](https://phpackages.com/packages/vanam-kdyby-doctrine-mysql-come-back)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k280.5M5.5k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k114.4M86](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k51.5M8.1k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k62.7M487](/packages/mongodb-mongodb)[spatie/laravel-translatable

A trait to make an Eloquent model hold translations

2.4k22.1M345](/packages/spatie-laravel-translatable)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.5k23.2M24](/packages/kirschbaum-development-eloquent-power-joins)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
