PHPackages                             lulco/redis-proxy - 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. [Caching](/categories/caching)
4. /
5. lulco/redis-proxy

ActiveLibrary[Caching](/categories/caching)

lulco/redis-proxy
=================

Library for Redis driver abstraction

1.9.0(2mo ago)3159.0k↑13.1%9[2 PRs](https://github.com/lulco/redis-proxy/pulls)1MITPHPPHP ^7.4 | ^8.0CI passing

Since Apr 22Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/lulco/redis-proxy)[ Packagist](https://packagist.org/packages/lulco/redis-proxy)[ RSS](/packages/lulco-redis-proxy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (26)Used By (1)

Redis proxy
===========

[](#redis-proxy)

Library for creating redis instance depends on application / server possibilities

[![Build Status](https://camo.githubusercontent.com/4a6a74b7107bb500b47e8a47d27ddf3c92ff37c9f6f64168dac08bf0c3ce641e/68747470733a2f2f7472617669732d63692e6f72672f6c756c636f2f72656469732d70726f78792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/lulco/redis-proxy)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/afc47c2d087b2d18dda103a01a74ca0bf56eccf311555c29b309cd924ba91021/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c756c636f2f72656469732d70726f78792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lulco/redis-proxy/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/30e810867bf461abbb1e6cabe5b139a465c70102a0f0b1e67edd920c2b0e9f7b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c756c636f2f72656469732d70726f78792f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lulco/redis-proxy/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/24653d0168d19cc54d5292bfcc30d3f12f33c53f40c2bc7d13b9bca208bee6e9/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f36313431303963312d323631612d343332612d396133322d3530643731333862303063342f6d696e692e706e67)](https://insight.sensiolabs.com/projects/614109c1-261a-432a-9a32-50d7138b00c4)[![Latest Stable Version](https://camo.githubusercontent.com/54cef3af6d38c7fef1289c8085cd5a44be7b2da4acb48c54a7bf850e0ed7ee32/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c756c636f2f72656469732d70726f78792e737667)](https://packagist.org/packages/lulco/redis-proxy)[![Total Downloads](https://camo.githubusercontent.com/a3ef86a2db4e04b376ed6078106ea6423129b6ac7738eac10ca95b44a0cd56aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c756c636f2f72656469732d70726f78792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lulco/redis-proxy)[![PHP 7 ready](https://camo.githubusercontent.com/431278a77c8f5aaf76896f91db31df2673e1357d114ff62db17abefd92b3a81b/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f6c756c636f2f72656469732d70726f78792f6d61737465722f62616467652e737667)](https://travis-ci.org/lulco/redis-proxy)

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

[](#installation)

### Composer

[](#composer)

The fastest way to install Redis proxy is to add it to your project using Composer ().

1. Install Composer: ```
    curl -sS https://getcomposer.org/installer | php

    ```
2. Require Redis proxy as a dependency using Composer: ```
    php composer.phar require lulco/redis-proxy

    ```
3. Install Redis proxy: ```
    php composer.phar update

    ```

Usage
-----

[](#usage)

### Single redis node

[](#single-redis-node)

```
$database = 0;
$timeout = 0.0;
$retryWait = null;
$maxFails = null;
$optSerializer = \RedisProxy\ConnectionFactory\Serializers::NONE;
$operationTimeout = null;
$connectMode = \RedisProxy\RedisProxy::CONNECT_MODE_CONNECT; // or CONNECT_MODE_PCONNECT

$redis = new \RedisProxy\RedisProxy(
    $host,
    $port,
    $database,
    $timeout,
    $retryWait,
    $maxFails,
    $optSerializer,
    $operationTimeout,
    $connectMode
);

// Call redis methods
$redis->select($database);
$redis->hset($key, $field, $value);
$redis->hlen($key);
$redis->hget($key, $field);
$redis->hgetall($key);
...
```

### Connection parameters

[](#connection-parameters)

- `timeout`: timeout for establishing connection in seconds (`0.0` = unlimited)
- `operationTimeout`: read/write timeout in seconds (`null` = default driver behavior)
- `retryWait`: delay before retry in milliseconds
- `maxFails`: number of attempts (`1` = one attempt, no retry)
- `optSerializer`: `none`, `php`, `json`, `msgpack`, `igbinary`
- `connectMode`: `connect` or `pconnect`

### Sentinel

[](#sentinel)

```
$sentinels = [
    ['host' => '172.19.0.5', 'port' => 26379],
    ['host' => '172.19.0.6', 'port' => 26379],
    ['host' => '172.19.0.7', 'port' => 26379],
];
$clusterId = 'mymaster';
$database = 0;
$timeout = 0.0;
$retryWait = null;
$maxFails = null;
$writeToReplicas = true;
$operationTimeout = null;
$connectMode = \RedisProxy\RedisProxy::CONNECT_MODE_CONNECT; // or CONNECT_MODE_PCONNECT

$redis = new \RedisProxy\RedisProxy();
$redis->setSentinelConnectionPool(
    $sentinels,
    $clusterId,
    $database,
    $timeout,
    $retryWait,
    $maxFails,
    $writeToReplicas,
    $operationTimeout,
    $connectMode
);

// Call redis methods
$redis->hset($key, $field, $value);
$redis->hlen($key);
$redis->hget($key, $field);
$redis->hgetall($key);
```

### Multi read connection

[](#multi-read-connection)

Read from multiple redis nodes Write to one master redis node

```
$master = ['host' => '172.19.0.5', 'port' => 26379];
$slaves = [
    ['host' => '172.19.0.5', 'port' => 26379],
    ['host' => '172.19.0.6', 'port' => 26379],
    ['host' => '172.19.0.7', 'port' => 26379],
];
$database = 0;
$timeout = 0.0;
$retryWait = null;
$maxFails = null;
$writeToReplicas = true;
$operationTimeout = null;
$connectMode = \RedisProxy\RedisProxy::CONNECT_MODE_CONNECT; // or CONNECT_MODE_PCONNECT

$redis = new \RedisProxy\RedisProxy();
$redis->setMultiConnectionPool(
    $master,
    $slaves,
    $database,
    $timeout,
    $retryWait,
    $maxFails,
    $writeToReplicas,
    $operationTimeout,
    $connectMode
);
```

### Multi write connection

[](#multi-write-connection)

Write to multiple master redis nodes Optionally read from multiple redis nodes

```
$masters = [
    ['host' => '172.19.0.5', 'port' => 26379],
    ['host' => '172.19.0.6', 'port' => 26379],
    ['host' => '172.19.0.7', 'port' => 26379],
];
$slaves = [
    ['host' => '172.19.0.5', 'port' => 26379],
    ['host' => '172.19.0.6', 'port' => 26379],
    ['host' => '172.19.0.7', 'port' => 26379],
];
$database = 0;
$timeout = 0.0;
$retryWait = null;
$maxFails = null;
$writeToReplicas = true;
$strategy = \RedisProxy\ConnectionPool\MultiWriteConnectionPool::STRATEGY_RANDOM;
$operationTimeout = null;
$connectMode = \RedisProxy\RedisProxy::CONNECT_MODE_CONNECT; // or CONNECT_MODE_PCONNECT

$redis = new \RedisProxy\RedisProxy();
$redis->setMultiWriteConnectionPool(
    $masters,
    $slaves,
    $database,
    $timeout,
    $retryWait,
    $maxFails,
    $writeToReplicas,
    $strategy,
    $operationTimeout,
    $connectMode
);
```

### RedisProxyFactory config

[](#redisproxyfactory-config)

Single node:

```
$config = [
    'host' => '127.0.0.1',
    'port' => 6379,
    'database' => 0,
    'timeout' => 0.0,
    'retryWait' => null,
    'maxFails' => null,
    'operationTimeout' => null,
    'connectMode' => 'connect', // or 'pconnect'
    'optSerializer' => 'none', // or 'php', 'json', 'msgpack', 'igbinary'
];

$redis = (new \RedisProxy\RedisProxyFactory())->createFromConfig($config);
```

Sentinel:

```
$config = [
    'sentinel' => [
        'sentinels' => [
            ['host' => '172.19.0.5', 'port' => 26379],
            ['host' => '172.19.0.6', 'port' => 26379],
        ],
        'clusterId' => 'mymaster',
        'database' => 0,
        'timeout' => 0.0,
        'retryWait' => null,
        'maxFails' => null,
        'writeToReplicas' => true,
        'operationTimeout' => null,
        'connectMode' => 'connect', // or 'pconnect'
    ],
];

$redis = (new \RedisProxy\RedisProxyFactory())->createFromConfig($config);
```

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance86

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

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

###  Release Activity

Cadence

Every ~156 days

Recently: every ~73 days

Total

24

Last Release

71d ago

Major Versions

0.7.1 → 1.0.02023-09-06

PHP version history (5 changes)0.1.0PHP &gt;= 5.6.0

0.4.0PHP &gt;= 7.1.0

0.5.0PHP &gt;= 7.4 &lt;8.2

0.7.1PHP &gt;= 7.4 &lt;8.3

1.2.0PHP ^7.4 | ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9377319?v=4)[Michal Lulco](/maintainers/lulco)[@lulco](https://github.com/lulco)

---

Top Contributors

[![lulco](https://avatars.githubusercontent.com/u/9377319?v=4)](https://github.com/lulco "lulco (59 commits)")[![riki137](https://avatars.githubusercontent.com/u/1223388?v=4)](https://github.com/riki137 "riki137 (4 commits)")[![ricco24](https://avatars.githubusercontent.com/u/1409647?v=4)](https://github.com/ricco24 "ricco24 (3 commits)")[![Martin-Beranek](https://avatars.githubusercontent.com/u/89643709?v=4)](https://github.com/Martin-Beranek "Martin-Beranek (3 commits)")[![riskar](https://avatars.githubusercontent.com/u/8099443?v=4)](https://github.com/riskar "riskar (3 commits)")[![andrejjursa](https://avatars.githubusercontent.com/u/2331773?v=4)](https://github.com/andrejjursa "andrejjursa (2 commits)")[![erko185](https://avatars.githubusercontent.com/u/56078866?v=4)](https://github.com/erko185 "erko185 (2 commits)")[![rasstislav](https://avatars.githubusercontent.com/u/9253113?v=4)](https://github.com/rasstislav "rasstislav (1 commits)")[![mikoczy](https://avatars.githubusercontent.com/u/14105084?v=4)](https://github.com/mikoczy "mikoczy (1 commits)")

---

Tags

predisproxyredisphpredispredis

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lulco-redis-proxy/health.svg)

```
[![Health](https://phpackages.com/badges/lulco-redis-proxy/health.svg)](https://phpackages.com/packages/lulco-redis-proxy)
```

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

975163.6k2](/packages/awssat-laravel-visits)[swoft/redis

swoft redis component

12168.4k16](/packages/swoft-redis)[maykonn/codeigniter-predis

The CodeIgniter Redis package

129.3k](/packages/maykonn-codeigniter-predis)[quick/cache

This is a cache system that uses Redis for rapid caching.

122.7k](/packages/quick-cache)[eftec/cacheone

A Cache library with minimum dependency

103.5k4](/packages/eftec-cacheone)

PHPackages © 2026

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