PHPackages                             jdomenechb/renew-doctrine-connection - 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. jdomenechb/renew-doctrine-connection

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

jdomenechb/renew-doctrine-connection
====================================

Renews Doctrine DBAL connections that have been closed or timed out.

v1.0(7y ago)16.2k1MITPHP

Since Sep 9Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jdomenechb/renew-doctrine-connection)[ Packagist](https://packagist.org/packages/jdomenechb/renew-doctrine-connection)[ RSS](/packages/jdomenechb-renew-doctrine-connection/feed)WikiDiscussions master Synced 1mo ago

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

Renew Doctrine Connection
=========================

[](#renew-doctrine-connection)

This library eases the process of renewing an existing [Doctrine](https://www.doctrine-project.org/) connection in your application that has been closed due to a timeout from the server. This might happen when the connection expires or the server has become unavailable.

When the connection is lost, the application usually throws an error like (in MySQL):

```
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

```

It is recommended to install this library only in daemons, consumers, PHP-only servers or very long processes, that is, **any PHP project that relies solely in a lengthy PHP process to run**. That does not include normal PHP applications running in web servers like Nginx or Apache, unless they have expensive algorythtms that rely on the database. Otherwise, you might be suffering some undesired overhead in your application.

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

[](#installation)

Add this library to your project using [Composer](https://getcomposer.org/):

```
composer require jdomenechb/renew-doctrine-connection
```

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

[](#configuration)

Modify your Doctrine configuration to use the `TimedRenewConnection` contained in this library as the wrapper class of Doctrine. In Symfony, for example, configuration will look like:

```
doctrine:
    dbal:
        # ...
        wrapper_class: 'Jdomenechb\Doctrine\DBAL\TimedRenewConnection'
        options:
            secondsToRenew: 60
```

You can freely customize the parameter `secondsToRenew`. The database connection will be renewed only after the seconds of inactivity you specify in this parameter. If it is set to `0` or not set at all, the connection will be renewed before every operation performed to the database.

For example, a good value to assign to this parameter, in MySQL, is the value of the MySQL system variable `wait_timeout`.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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

Unknown

Total

1

Last Release

2802d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1197b4ce0411048910993d1b98874c69f8811614aefc414b012d0eb7e4c7a314?d=identicon)[jdomenechb](/maintainers/jdomenechb)

---

Top Contributors

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

---

Tags

connectiondbdoctrinedoctrine-dbalrenew

### Embed Badge

![Health badge](/badges/jdomenechb-renew-doctrine-connection/health.svg)

```
[![Health](https://phpackages.com/badges/jdomenechb-renew-doctrine-connection/health.svg)](https://phpackages.com/packages/jdomenechb-renew-doctrine-connection)
```

###  Alternatives

[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M36](/packages/scienta-doctrine-json-functions)[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4485.3M4](/packages/martin-georgiev-postgresql-for-doctrine)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[worksome/foggy

Foggy is a tool for making database dumps with some data removed/changed.

26571.7k1](/packages/worksome-foggy)

PHPackages © 2026

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