Download the PHP package namoshek/laravel-redis-sentinel without Composer

On this page you can find all versions of the php package namoshek/laravel-redis-sentinel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-redis-sentinel

Laravel Redis Sentinel driver for phpredis/phpredis PHP extension

Latest Version on Packagist Total Downloads Tests Quality Gate Status Maintainability Rating Reliability Rating Security Rating Vulnerabilities License

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. The primary difference is that this driver supports the phpredis/phpredis PHP extension 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 already supports connecting to Redis through one or more Sentinels.

Installation

You can install the package via composer:

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

Configuration

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

Usage

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

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.

SSL/TLS Support

If you want to use SSL/TLS to connect to Redis Sentinel, you need to add an additional configuration option sentinel_ssl next to the other sentinel_* settings:

Available SSL context options can be found in the official PHP documentation. Please note that SSL support for the Sentinel connection was added to the phpredis extension starting in version 6.1.

Also note that if your Redis Sentinel resolves SSL connections to Redis, you potentially need to add additional context options for your Redis connection:

A full configuration example using SSL for Redis Sentinel as well as Redis looks like this if authentication is also enabled (environment variables omitted for clarity):

The important parts are the tls:// protocol in sentinel_host as well as the tls in scheme, plus the sentinel_ssl and context.stream options.

Because Redis Sentinel resolves Redis instances by IP and port, your Redis certificate needs to have the IP as SAN. Alternatively, you can set verify_peer and maybe also verify_peer_name to false.

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, 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

To run the tests locally, a Redis cluster needs to be running. The repository contains a script (thanks to 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.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-redis-sentinel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-redis Version *
illuminate/contracts Version ^8.0|^9.0|^10.0|^11.0
illuminate/redis Version ^8.0|^9.0|^10.0|^11.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package namoshek/laravel-redis-sentinel contains the following files

Loading the files please wait ....