PHPackages                             arntech/doctrine-timeout-handler - 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. arntech/doctrine-timeout-handler

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

arntech/doctrine-timeout-handler
================================

ARNTech Doctrine Timeout handler.

v0.0.2(5y ago)0471GPL-3.0-onlyPHPPHP ^5.6 || ^7.0

Since Jul 27Pushed 5y ago2 watchersCompare

[ Source](https://github.com/ARNTechnology/doctrine-timeout-handler)[ Packagist](https://packagist.org/packages/arntech/doctrine-timeout-handler)[ RSS](/packages/arntech-doctrine-timeout-handler/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

arntech/doctrine-timeout-handler
================================

[](#arntechdoctrine-timeout-handler)

[![Source Code](https://camo.githubusercontent.com/4981c0fadf2ff240e7c7a26938adf761ee763ab2e2669c9205ca30d2fc39fa68/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d736f75726365266d6573736167653d61726e746563682f646f637472696e652d74696d656f75742d68616e646c657226636f6c6f723d626c7565267374796c653d666c61742d737175617265)](https://github.com/ARNTechnology/doctrine-timeout-handler)[![Latest Version](https://camo.githubusercontent.com/920bb5a3f07d3aa6116f2206d698ab3e30b6a7054530b874996ae5b081991f30/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61726e746563682f646f637472696e652d74696d656f75742d68616e646c65722e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://packagist.org/packages/arntech/doctrine-timeout-handler)[![Software License](https://camo.githubusercontent.com/69fb96e54aa4209d11538c1f672120886a95ac8e200050c1dd045526a8b64207/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61726e746563682f646f637472696e652d74696d656f75742d68616e646c65722e7376673f7374796c653d666c61742d737175617265)](https://github.com/ARNTechnology/doctrine-timeout-handler/blob/master/LICENSE)[![PHP Version](https://camo.githubusercontent.com/27302328908265f6a312811d36429e0c145d6dc3b73c9b95fe2bc4c113689bbd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f61726e746563682f646f637472696e652d74696d656f75742d68616e646c65722e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Total Downloads](https://camo.githubusercontent.com/8b25dad43140988f04ddfcd730b8ac6b56368358cd79b3d224c17366401e8226/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61726e746563682f646f637472696e652d74696d656f75742d68616e646c65722e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d6d656469756d76696f6c6574726564)](https://packagist.org/packages/arntech/doctrine-timeout-handler)

What is this?
-------------

[](#what-is-this)

It is a library that tries to handle DB connection timeouts and "The MySQL server has gone away (error 2006)" errors.

Installation
------------

[](#installation)

The preferred method of installation is via \[Composer\]\[\]. Run the following command to install the package and add it as a requirement to your project's `composer.json`:

```
composer require arntech/doctrine-timeout-handler
```

Dependency
----------

[](#dependency)

The library uses \[psr/log\]\[\] and \[facile-it/doctrine-mysql-come-back\]\[\]

Configuration
-------------

[](#configuration)

It a similar configuration as facile-it solution (for a quick migration).

```
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' => 'ARNTech\DoctrineTimeout\Connection',
    'driverClass' => 'ARNTech\DoctrineTimeout\Driver\PDOMySql\Driver',
    'driverOptions' => array(
        'x_reconnect_attempts' => 3,
		'check_connection_beforehand' => true //this specifies to check if connection is still alive before executing anything
    )
);

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

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: 'ARNTech\DoctrineTimeout\Connection'
                driver_class: 'ARNTech\DoctrineTimeout\Driver\PDOMySql\Driver'
                options:
                    x_reconnect_attempts: 3
					check_connection_beforehand: true #this specifies to check if connection is still alive before executing anything
```

If you are setting up your database connection using a DSN/`database_url` env variable (like the Doctrine Symfony Flex recipe suggests) **you need to remove the protocol** from your database url. Otherwise, Doctrine is going to ignore your `driver_class` configuration and use the default protocol driver, which will lead you to an error.

```
doctrine:
    dbal:
        connections:
            default:
                # DATABASE_URL needs to be without driver protocol.
                # use "//db_user:db_password@127.0.0.1:3306/db_name"
                # instead of "mysql://db_user:db_password@127.0.0.1:3306/db_name"
                url: '%env(resolve:DATABASE_URL)%'
                wrapper_class: 'ARNTech\DoctrineTimeout\Connection'
                driver_class: 'ARNTech\DoctrineTimeout\Driver\PDOMySql\Driver'
                options:
                    x_reconnect_attempts: 3
					check_connection_beforehand: true #this specifies to check if connection is still alive before executing anything
```

An example of configuration on Zend Framework 2/3 projects:

```
return [
    'doctrine' => [
        'connection' => [
            'orm_default' => [
                'driverClass' => \ARNTech\DoctrineTimeout\Driver\PDOMySql\Driver::class,
                'wrapperClass' => \ARNTech\DoctrineTimeout\Connection::class,
                'params' => [
                    'host' => 'localhost',
                    'port' => '3307',
                    'user' => '##user##',
                    'password' => '##password##',
                    'dbname' => '##database##',
                    'charset' => 'UTF8',
                    'driverOptions' => [
                        'x_reconnect_attempts' => 9,
						'check_connection_beforehand' => true //this specifies to check if connection is still alive before executing anything
                    ]
                ],
            ],
        ],
    ],
];
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~8 days

Total

2

Last Release

2109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cf9a1274de5297ee35726da23eaa626551cb640d3ef536b18ccf24be517aa92?d=identicon)[arntech](/maintainers/arntech)

---

Top Contributors

[![alxnegrila](https://avatars.githubusercontent.com/u/4835042?v=4)](https://github.com/alxnegrila "alxnegrila (4 commits)")

---

Tags

doctrinetimeoutdoctrine timeouttime outdoctrine time out

### Embed Badge

![Health badge](/badges/arntech-doctrine-timeout-handler/health.svg)

```
[![Health](https://phpackages.com/badges/arntech-doctrine-timeout-handler/health.svg)](https://phpackages.com/packages/arntech-doctrine-timeout-handler)
```

###  Alternatives

[ddeboer/data-import

Import data from, and export data to, a range of file formats and media

5604.3M9](/packages/ddeboer-data-import)[api-platform/schema-generator

Various tools to generate a data model based on Schema.org vocables

4714.2M7](/packages/api-platform-schema-generator)[nettrine/orm

Doctrine ORM for Nette Framework

581.9M37](/packages/nettrine-orm)[nettrine/dbal

Doctrine DBAL for Nette Framework

322.6M19](/packages/nettrine-dbal)[h4cc/alice-fixtures-bundle

Symfony2 Bundle for loading fixture data with the Alice library.

76314.2k7](/packages/h4cc-alice-fixtures-bundle)[paysera/lib-pagination

Paginates Doctrine QueryBuilder using cursor based or offset based pagination

13191.8k1](/packages/paysera-lib-pagination)

PHPackages © 2026

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