PHPackages                             andriusgecius/redundant-db - 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. andriusgecius/redundant-db

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

andriusgecius/redundant-db
==========================

Connection manager for high availability database clusters

1.0.3(5y ago)184MITPHPPHP &gt;=5.2.0

Since Oct 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/andriusGecius/RedundantDB)[ Packagist](https://packagist.org/packages/andriusgecius/redundant-db)[ RSS](/packages/andriusgecius-redundant-db/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)DependenciesVersions (6)Used By (0)

RedundantDB
===========

[](#redundantdb)

Connection manager for high availability database clusters

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

[](#what-is-this)

Let`s say you have a distributed database cluster whith 2 APIs. Both APIs point you to exactly the same database. Which API do you connect to? What happens if one of those APIs suddenly die? How fast can you redirect all your database connections to the healthy API?

This is how RedundantDB class helps you!

Main Features
-------------

[](#main-features)

- **Easy** - just provide connection information and you are ready to connect
- **Smart** - Finds the fastest/shortest route to the API. Immediatelly switches APIs if the current one is unreachable
- **PDO** - Returns PDO object if successfully connected
- **Dependencies** - Depends on \\Memcached and \\PDO

Get Started
-----------

[](#get-started)

### Install via composer

[](#install-via-composer)

Add RedundantDB to composer.json configuration file.

```
$ composer require andriusgecius/RedundantDB

```

And update the composer

```
$ composer update

```

```
// Require compser autoloader file
require 'vendor/autoload.php';

// Initialize
$dbConfig = [
    1 => [
        'host' => 'HOSTNAME',
        'port' => 3306,
        'database' => 'DBNAME',
        'username' => 'USERNAME',
        'password' => 'PASSWORD',
        'type' => 'mysql'
    ],
    2 => [
        'host' => 'HOSTNAME',
        'port' => 3306,
        'database' => 'DBNAME',
        'username' => 'USERNAME',
        'password' => 'PASSWORD',
        'type' => 'mysql'
    ],
    'memc' => [
        'host' => 'localhost',
        'port' => 11211
    ],
    'charset' => 'utf8'
];

$RedundantDB = new \RedundantDB\Connection($dbConfig);
$connect = $RedundantDB->connect(); //Returns PDO
```

Disclaimer
----------

[](#disclaimer)

This connection manager has been tested only with MySQL cluster. Any contributions from developers who have experience with different high availability relational database clusters are highly appreciated!

License
-------

[](#license)

Please use it as you please!

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

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

Every ~465 days

Total

4

Last Release

2162d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20628712?v=4)[andriusgecius](/maintainers/andriusgecius)[@andriusGecius](https://github.com/andriusGecius)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/andriusgecius-redundant-db/health.svg)

```
[![Health](https://phpackages.com/badges/andriusgecius-redundant-db/health.svg)](https://phpackages.com/packages/andriusgecius-redundant-db)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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