PHPackages                             dmlogic/pdo-retry-wrapper - 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. dmlogic/pdo-retry-wrapper

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

dmlogic/pdo-retry-wrapper
=========================

PDO wrapper to gracefully handle dropped connections

v0.1(4y ago)13.7k1PHPPHP ^7.4|^8.0

Since Oct 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/dmlogic/pdo-retry-wrapper)[ Packagist](https://packagist.org/packages/dmlogic/pdo-retry-wrapper)[ RSS](/packages/dmlogic-pdo-retry-wrapper/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

PHP PDO retry wrapper
=====================

[](#php-pdo-retry-wrapper)

I wish I didn't have to make this. But RDS under AWS is not nearly as available as the metrics claim.

This is inspired by the dropped connection retry mechanisms built into illuminate/database. I want the same here but at a much lower level for PDO.

Provides this functionality:

- Retry queries that failed due to connection issues up to a maximum number of attempts
- Define a callback to run if the limit is reached
- Combines `$pdo->prepare($sql)` and `$pdo->execute($bindings)` into a single `$connection->runQuery($sql, $bindings)` call

Usage

```
// Connector is a Closure for simpler reconnects
$pdoConnector = function() {
    return new PDO(
            'dsnString',
            'username',
            'password',
            [
                PDO::OPTION_NAME => VALUE,
                ...
            ]
        );
};

// Optional exception callback can be anything at all
// It's a handy place to centralise the error handling
// logic if you don't want queries inside try/catch
$callback = function(ConnectionException $exception) {
    $exception->getAttempts();
    $exception->getOriginalException();
    $exception->getQuery();
    $exception->getBindings();
}

// Create the wrapper
$dbConnection = new Connection($pdoConnector, $callback);

// Generate a PDOStatement with results
try {
    $query = $dbConnection->runQuery('select * from users where id = ?', [123]);
    $user = $query->fetch(PDO::FETCH_OBJ);
} catch(ConnectionException $e) {
    // We know we failed on connection
    // $callback has been invoked at this stage
} catch(Exception $e) {
    // Something else went down
}
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

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

Unknown

Total

1

Last Release

1731d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1250252?v=4)[Darren Miller](/maintainers/dmlogic)[@dmlogic](https://github.com/dmlogic)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dmlogic-pdo-retry-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/dmlogic-pdo-retry-wrapper/health.svg)](https://phpackages.com/packages/dmlogic-pdo-retry-wrapper)
```

###  Alternatives

[spatie/laravel-medialibrary

Associate files with Eloquent models

6.1k43.2M626](/packages/spatie-laravel-medialibrary)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M94](/packages/mongodb-laravel-mongodb)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M46](/packages/kirschbaum-development-eloquent-power-joins)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[awobaz/compoships

Laravel relationships with support for composite/multiple keys

1.2k11.7M46](/packages/awobaz-compoships)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.3M19](/packages/bavix-laravel-wallet)

PHPackages © 2026

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