PHPackages                             evertramos/laravel-redis-sentinel - 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. evertramos/laravel-redis-sentinel

ActiveLibrary[Caching](/categories/caching)

evertramos/laravel-redis-sentinel
=================================

An extension of Laravels Redis driver which supports connecting to a Redis master through Redis Sentinel.

v0.1.2(3y ago)04MITPHPPHP ^8.0

Since Jul 18Pushed 3y agoCompare

[ Source](https://github.com/evertramos/laravel-redis-sentinel)[ Packagist](https://packagist.org/packages/evertramos/laravel-redis-sentinel)[ Docs](https://github.com/Namoshek/laravel-redis-sentinel)[ RSS](/packages/evertramos-laravel-redis-sentinel/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Redis Sentinel driver for `phpredis/phpredis` PHP extension
===================================================================

[](#laravel-redis-sentinel-driver-for-phpredisphpredis-php-extension)

[![Latest Version on Packagist](https://camo.githubusercontent.com/eb03ff95cba36ef9a216ef3058e115cc6b45f79116e46948b4a41a5f74fac63e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e616d6f7368656b2f6c61726176656c2d72656469732d73656e74696e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/namoshek/laravel-redis-sentinel)[![Total Downloads](https://camo.githubusercontent.com/d5181663bcce38c45bfdae0fd88c33445da49aaf3bffbc1544cc3cedc8a51b08/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e616d6f7368656b2f6c61726176656c2d72656469732d73656e74696e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/namoshek/laravel-redis-sentinel)[![Tests](https://github.com/Namoshek/laravel-redis-sentinel/workflows/Tests/badge.svg)](https://github.com/Namoshek/laravel-redis-sentinel/actions?query=workflow%3ATests)[![Quality Gate Status](https://camo.githubusercontent.com/eb7320703afa3ad5ba13461501bfa1beb29659c5cf2584bc0b5d31ca3d5c374b/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6e616d6f7368656b5f6c61726176656c2d72656469732d73656e74696e656c266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=namoshek_laravel-redis-sentinel)[![Maintainability Rating](https://camo.githubusercontent.com/ac541d1ea9ee474345f878c263d601ae52f1b5fb1371da8d02aed1681abdaf53/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6e616d6f7368656b5f6c61726176656c2d72656469732d73656e74696e656c266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/dashboard?id=namoshek_laravel-redis-sentinel)[![Reliability Rating](https://camo.githubusercontent.com/60ec0a7f3695e89d24737ed8f2b9e637a689ef346da997a0a8962ecd8f58e226/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6e616d6f7368656b5f6c61726176656c2d72656469732d73656e74696e656c266d65747269633d72656c696162696c6974795f726174696e67)](https://sonarcloud.io/dashboard?id=namoshek_laravel-redis-sentinel)[![Security Rating](https://camo.githubusercontent.com/8ed1ea572e1ccf2e7ec7e0c6fd3bfcf0b573032c6538e8e420459fdd1a7f17c0/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6e616d6f7368656b5f6c61726176656c2d72656469732d73656e74696e656c266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/dashboard?id=namoshek_laravel-redis-sentinel)[![Vulnerabilities](https://camo.githubusercontent.com/ca68b5d80de906193a1864bb003bb8758833b0d423c7ff676b8c5f647dfcfc65/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6e616d6f7368656b5f6c61726176656c2d72656469732d73656e74696e656c266d65747269633d76756c6e65726162696c6974696573)](https://sonarcloud.io/dashboard?id=namoshek_laravel-redis-sentinel)[![License](https://camo.githubusercontent.com/e5c8859b05b68be71d81aead92dccbe5f30afd6f2f74a9c2125f7ef8cf4588bd/68747470733a2f2f706f7365722e707567782e6f72672f6e616d6f7368656b2f6c61726176656c2d72656469732d73656e74696e656c2f6c6963656e7365)](https://packagist.org/packages/namoshek/laravel-redis-sentinel)

This package provides a Laravel Redis driver which allows connecting to a Redis master through a Redis Sentinel instance. The package is intended to be used in a Kubernetes environment or similar, where connecting to Redis Sentinels is possible through a load balancer.

This driver is an alternative to [`monospice/laravel-redis-sentinel-drivers`](https://github.com/monospice/laravel-redis-sentinel-drivers). The primary difference is that this driver supports the [`phpredis/phpredis` PHP extension](https://github.com/phpredis/phpredis)and has significantly simpler configuration, due to a simpler architecture. In detail this means that this package does not override the entire Redis subsystem of Laravel, it only adds an additional driver.

By default, Laravel supports the `predis` and `phpredis` drivers. This package adds a third `phpredis-sentinel` driver, which is an extension of the `phpredis` driver for Redis Sentinel. An extension for `predis` is currently not available and not necessary, since [`predis/predis`](https://github.com/predis/predis) already supports connecting to Redis through one or more Sentinels.

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

[](#installation)

You can install the package via composer:

```
composer require namoshek/laravel-redis-sentinel
```

The service provider which comes with the package is registered automatically.

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

[](#configuration)

The package requires no extra configuration and does therefore not provide an additional configuration file.

Usage
-----

[](#usage)

To use the Redis Sentinel driver, the `redis` section in `config/database.php` needs to be adjusted:

```
'redis' => [

    'client' => env('REDIS_CLIENT', 'phpredis-sentinel'),

    'default' => [
        'sentinel_host' => env('REDIS_SENTINEL_HOST', '127.0.0.1'),
        'sentinel_port' => env('REDIS_SENTINEL_PORT', 26379),
        'sentinel_service' => env('REDIS_SENTINEL_SERVICE', 'mymaster'),
        'sentinel_timeout' => env('REDIS_SENTINEL_TIMEOUT', 0),
        'sentinel_persistent' => env('REDIS_SENTINEL_PERSISTENT'),
        'sentinel_retry_interval' => env('REDIS_SENTINEL_RETRY_INTERVAL', 0),
        'sentinel_read_timeout' => env('REDIS_SENTINEL_READ_TIMEOUT', 0),
        'sentinel_password' => env('REDIS_SENTINEL_PASSWORD'),
        'password' => env('REDIS_PASSWORD'),
        'database' => env('REDIS_DB', 0),
    ]
]
```

Instead of changing `redis.client` in the configuration file directly, you can also set `REDIS_CLIENT=phpredis-sentinel` in the environment variables.

As you can see, there are also a few new `sentinel_*` options available for each Redis connection. Most of them work very similar to the normal Redis options, except that they are used for the connection to Redis Sentinel. Noteworthy is the `sentinel_service`, which represents the instance name of the monitored Redis master.

All other options are the same for the Redis Sentinel driver, except that `url` is not supported and `host` and `port` are ignored.

### How does it work?

[](#how-does-it-work)

An additional Laravel Redis driver is added (`phpredis-sentinel`), which resolves the currently declared master instance of a replication cluster as active Redis instance. Under the hood, this driver relies on the framework driver for [`phpredis/phpredis`](https://github.com/phpredis/phpredis), it only wraps the connection part of it and adds some error handling which forcefully reconnects in case of a failover.

Please be aware that this package does not manage load balancing between Sentinels (which is supposed to be done on an infrastructure level) and does also not load balance read/write calls to replica/master nodes. All traffic is sent to the currently reported master.

Developing
----------

[](#developing)

To run the tests locally, a Redis cluster needs to be running. The repository contains a script (thanks to [`monospice/laravel-redis-sentinel-drivers`](https://github.com/monospice/laravel-redis-sentinel-drivers)) which can be used to start one by running `sh start-redis-cluster.sh`. The script requires that Redis is installed on your machine. To install Redis on Ubuntu or Debian, you can use `sudo apt update && sudo apt install redis-server`. For other operating systems, please see [redis.io](https://redis.io/).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.1% 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 ~151 days

Total

3

Last Release

1458d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/593dc3acdb8db124d1b2dc735da76cf2b13522a5ba58db6566ff977a65f10c79?d=identicon)[evertramos](/maintainers/evertramos)

---

Top Contributors

[![Namoshek](https://avatars.githubusercontent.com/u/8877609?v=4)](https://github.com/Namoshek "Namoshek (39 commits)")[![evertramos](https://avatars.githubusercontent.com/u/905951?v=4)](https://github.com/evertramos "evertramos (2 commits)")

---

Tags

laravelredis

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/evertramos-laravel-redis-sentinel/health.svg)

```
[![Health](https://phpackages.com/badges/evertramos-laravel-redis-sentinel/health.svg)](https://phpackages.com/packages/evertramos-laravel-redis-sentinel)
```

###  Alternatives

[namoshek/laravel-redis-sentinel

An extension of Laravels Redis driver which supports connecting to a Redis master through Redis Sentinel.

38679.0k](/packages/namoshek-laravel-redis-sentinel)[yangusik/laravel-balanced-queue

Laravel queue management with load balancing between partitions (user groups)

786.4k](/packages/yangusik-laravel-balanced-queue)[monospice/laravel-redis-sentinel-drivers

Redis Sentinel integration for Laravel and Lumen.

103830.5k](/packages/monospice-laravel-redis-sentinel-drivers)[encore/redis-manager

Redis manager for laravel

25243.1k](/packages/encore-redis-manager)[vetruvet/laravel-phpredis

Use phpredis as the redis connection in Laravel

43123.7k](/packages/vetruvet-laravel-phpredis)[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)

PHPackages © 2026

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