PHPackages                             sinemacula/laravel-valkey-glide - 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. sinemacula/laravel-valkey-glide

ActiveLibrary[Caching](/categories/caching)

sinemacula/laravel-valkey-glide
===============================

Laravel Redis driver and adapter for Valkey GLIDE (ext-valkey\_glide).

v1.0.0(2w ago)0252[3 PRs](https://github.com/sinemacula/laravel-valkey-glide/pulls)Apache-2.0PHPPHP ^8.3CI passing

Since Apr 5Pushed 3mo agoCompare

[ Source](https://github.com/sinemacula/laravel-valkey-glide)[ Packagist](https://packagist.org/packages/sinemacula/laravel-valkey-glide)[ RSS](/packages/sinemacula-laravel-valkey-glide/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (16)Versions (6)Used By (0)

Laravel Valkey GLIDE Driver
===========================

[](#laravel-valkey-glide-driver)

[![Latest Stable Version](https://camo.githubusercontent.com/b1f6b9185c4e1930e63817c34fe258cf17fa3102f573c32e3f02380331fb0c79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696e656d6163756c612f6c61726176656c2d76616c6b65792d676c6964652e737667)](https://packagist.org/packages/sinemacula/laravel-valkey-glide)[![Build Status](https://github.com/sinemacula/laravel-valkey-glide/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/sinemacula/laravel-valkey-glide/actions/workflows/tests.yml)[![Quality Gates](https://github.com/sinemacula/laravel-valkey-glide/actions/workflows/quality-gates.yml/badge.svg?branch=master)](https://github.com/sinemacula/laravel-valkey-glide/actions/workflows/quality-gates.yml)[![Maintainability](https://camo.githubusercontent.com/f9752cda61da1db5327b2d8ec62c2a4358f532357d514ceefba40e8e61444a9c/68747470733a2f2f716c74792e73682f67682f73696e656d6163756c612f70726f6a656374732f6c61726176656c2d76616c6b65792d676c6964652f6d61696e7461696e6162696c6974792e737667)](https://qlty.sh/gh/sinemacula/projects/laravel-valkey-glide/maintainability)[![Code Coverage](https://camo.githubusercontent.com/90804473e1638a21c8a3ae4d885830b86bfbeee0225cbdf9c8f15a85dc405f96/68747470733a2f2f716c74792e73682f67682f73696e656d6163756c612f70726f6a656374732f6c61726176656c2d76616c6b65792d676c6964652f636f7665726167652e737667)](https://qlty.sh/gh/sinemacula/projects/laravel-valkey-glide/coverage)[![Total Downloads](https://camo.githubusercontent.com/88dbb3392091081ddff37edf59b3bb792bacd8835fed5daefa1976d6d9f39d0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696e656d6163756c612f6c61726176656c2d76616c6b65792d676c6964652e737667)](https://packagist.org/packages/sinemacula/laravel-valkey-glide)

Laravel Valkey GLIDE is a Laravel-native Redis integration for `ext-valkey_glide`.

It adds a `valkey-glide` Redis client driver to Laravel so cache, queue, session, and direct Redis usage can run through Valkey GLIDE using Laravel's existing Redis abstractions.

Purpose
-------

[](#purpose)

Managed Redis/Valkey platforms can drop sockets during maintenance, failover, scaling, or node replacement. This package integrates GLIDE into Laravel so reconnect behavior is handled at the client/connection layer rather than in application business code.

What Is Implemented
-------------------

[](#what-is-implemented)

- Service provider registration of the `valkey-glide` driver via `RedisManager::extend()`
- Connector implementing `Illuminate\Contracts\Redis\Connector`
- Connection wrapper extending `Illuminate\Redis\Connections\Connection`
- Laravel config normalization into GLIDE `connect()` arguments
- Optional single retry for idempotent commands on transient transport errors
- Key prefix compatibility for supported command families, including key-list handling for `MGET`
- Laravel compatibility fallback for phpredis-style `SET` and `EVAL` command argument shapes
- External test lane for extension and real Redis connectivity validation

Requirements
------------

[](#requirements)

- PHP `^8.3`
- Laravel components with `illuminate/redis` `^11.0 || ^12.0`
- `ext-valkey_glide` in runtime environments that use this driver

`ext-valkey_glide` is declared in `suggest` so this package can still be installed in environments that do not run the Valkey driver.

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

[](#installation)

```
composer require sinemacula/laravel-valkey-glide
```

Laravel Configuration
---------------------

[](#laravel-configuration)

Set Redis client in your environment:

```
REDIS_CLIENT=valkey-glide
```

Example single-node Redis connection:

```
'redis' => [
    'client' => env('REDIS_CLIENT', 'valkey-glide'),

    'default' => [
        'host' => env('REDIS_HOST', '127.0.0.1'),
        'port' => (int) env('REDIS_PORT', 6379),
        'username' => env('REDIS_USERNAME'),
        'password' => env('REDIS_PASSWORD'),
        'database' => (int) env('REDIS_DB', 0),
        'name' => env('REDIS_CLIENT_NAME'),
        'prefix' => env('REDIS_PREFIX', ''),
        'tls' => env('REDIS_TLS', false),
    ],
],
```

Supported Config Mapping
------------------------

[](#supported-config-mapping)

The connector normalizes Laravel config into GLIDE connect arguments:

- `host` / `port` -&gt; `addresses`
- `addresses` (array) -&gt; `addresses`
- `tls` or `scheme=tls` -&gt; `use_tls=true`
- `username` + `password` -&gt; ACL credentials
- `iam` block -&gt; IAM credentials + `use_tls=true`
- `database` -&gt; `database_id`
- `name` -&gt; `client_name`
- `read_from` -&gt; `read_from` (replica read routing; see Read Routing)
- `client_az` -&gt; `client_az` (availability zone for AZ-affinity routing)
- `context` -&gt; `context` (TLS stream context; array or resource)
- `timeout` (seconds) -&gt; `request_timeout` (milliseconds)
- `connection_timeout` (seconds) -&gt; `advanced_config.connection_timeout` (milliseconds)

Cluster-style configs are normalized into seed `addresses` and connected through the dedicated `ValkeyGlideCluster`client via `connectToCluster()`.

Runtime Behavior
----------------

[](#runtime-behavior)

Command execution goes through `ValkeyGlideConnection::command()`.

- Idempotent commands can retry once on recognized transient connection errors
- Non-idempotent commands are not retried
- Laravel command events are dispatched (`CommandExecuted`, `CommandFailed`)
- `executeRaw()` is supported via `rawcommand`
- Phpredis-style `SET`/`EVAL` argument shapes are normalized through `rawcommand`
- `disconnect()` delegates to GLIDE `close()`

Prefix Compatibility
--------------------

[](#prefix-compatibility)

Prefixing is handled in the connection wrapper for supported command families:

- single-key commands (`GET`, `SET`, `HGET`, etc.)
- all-key commands (`MGET`, `DEL`, etc.)
- two-key commands (`RENAME`, etc.)
- `EVAL` / `EVALSHA` key segments

Read Routing
------------

[](#read-routing)

GLIDE can route read commands to replicas. Set `read_from` on the connection to one of the following strategies (both the string name and the integer constant are accepted):

StrategyValueBehavior`primary``0`All reads go to the primary (default)`prefer_replica``1`Reads prefer replicas, falling back to the primary`az_affinity``2`Reads prefer replicas in the same AZ as `client_az``az_affinity_replicas_and_primary``3`Same-AZ affinity across replicas and the primary`client_az` is required for the AZ-affinity strategies.

```
'default' => [
    'host' => env('REDIS_HOST', '127.0.0.1'),
    'port' => (int) env('REDIS_PORT', 6379),
    'read_from' => env('REDIS_READ_FROM', 'prefer_replica'),
    'client_az' => env('REDIS_CLIENT_AZ'),
],
```

Timeouts and TLS Context
------------------------

[](#timeouts-and-tls-context)

The GLIDE core defaults the request timeout to 250ms, which can be too short for managed services during warm-up. Configure timeouts in seconds (matching the phpredis convention); they are converted to milliseconds for GLIDE:

- `timeout` (seconds) -&gt; `request_timeout`
- `connection_timeout` (seconds) -&gt; `advanced_config.connection_timeout`

Pass a custom TLS stream context (for custom CA certificates or verification settings) via the per-connection `context`key. Both a config-array and a pre-built `stream_context_create()` resource are accepted:

```
'default' => [
    'host' => env('REDIS_HOST', '127.0.0.1'),
    'tls' => true,
    'timeout' => 3.0,
    'context' => [
        'ssl' => [
            'cafile' => '/path/to/ca.crt',
            'verify_peer' => true,
        ],
    ],
],
```

Cluster Connections
-------------------

[](#cluster-connections)

Cluster connections use the dedicated `ValkeyGlideCluster` client, which follows cluster topology and slot routing. Configure a cluster the standard Laravel way:

```
'redis' => [
    'client' => 'valkey-glide',

    'clusters' => [
        'default' => [
            ['host' => env('REDIS_HOST'), 'port' => (int) env('REDIS_PORT', 6379)],
        ],
    ],
],
```

Raw commands (`EVAL` / `EVALSHA`, phpredis-style `SET` with options) are routed to the primary that owns the affected key's slot.

ElastiCache Serverless
----------------------

[](#elasticache-serverless)

AWS ElastiCache Serverless runs in cluster mode (single logical database, TLS required) and exposes the primary on port 6379 and the reader on port 6380. Configure it as a cluster with TLS, and optionally with replica read routing:

```
'redis' => [
    'client' => 'valkey-glide',

    'clusters' => [
        'default' => [
            [
                'host' => env('REDIS_HOST'),
                'port' => (int) env('REDIS_PORT', 6379),
                'tls' => true,
                'read_from' => 'prefer_replica',
                'timeout' => 3.0,
            ],
        ],
    ],
],
```

Keep the database index at `0` - cluster mode exposes only database 0. When using replica read routing, ensure the security group allows both port 6379 (read/write) and 6380 (read-only).

Testing
-------

[](#testing)

The default suite is deterministic and requires no local Redis server:

```
composer test
```

The external suite exercises the real `ext-valkey_glide` extension against a live Valkey/Redis server. It is excluded from the default run and must be invoked explicitly:

```
composer test:external
```

External integration coverage includes:

- extension/client availability and connect/close behavior
- connector/connection roundtrip behavior and retry semantics
- command-prefix behavior, including list-style key commands (`MGET`)
- Laravel cache roundtrip behavior, physical key writes, locks, and TTL edge cases
- Laravel queue push/pop behavior and physical queue key writes
- Laravel session roundtrip behavior and physical session key writes

The external suite reads connection details from optional environment variables:

- `VALKEY_GLIDE_TEST_HOST`
- `VALKEY_GLIDE_TEST_PORT`
- `VALKEY_GLIDE_TEST_TLS`
- `VALKEY_GLIDE_TEST_USERNAME`
- `VALKEY_GLIDE_TEST_PASSWORD`

All available Composer scripts:

```
composer test                # PHPUnit suite in parallel via Paratest (excludes external)
composer test:external       # external suite against a live Valkey/Redis server
composer test:coverage       # suite with Clover coverage output
composer test:mutation       # Infection mutation gate (min MSI 90)
composer test:mutation:full  # full mutation suite without thresholds
composer check               # static analysis and lint via qlty
composer format              # format via qlty
composer smells              # duplication / complexity smells via qlty
composer bench               # PHPBench suite over the command / config hot paths
composer bench:ci            # PHPBench with CI artifact dump
composer bench:smoke         # single-rev pass to verify every subject runs
```

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for a list of notable changes.

Contributing
------------

[](#contributing)

Contributions are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on branching, commits, code quality, and pull requests.

Security
--------

[](#security)

If you discover a security vulnerability, please report it responsibly. See [SECURITY.md](SECURITY.md) for the disclosure policy and contact details.

License
-------

[](#license)

Licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).

###  Health Score

42

↑

FairBetter than 88% of packages

Maintenance89

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

15d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6262ea965c244b0c946a2f29a94da05e30846c066a0b59399466216654c78fe6?d=identicon)[sinemacula](/maintainers/sinemacula)

---

Top Contributors

[![sinemacula-ben](https://avatars.githubusercontent.com/u/118753672?v=4)](https://github.com/sinemacula-ben "sinemacula-ben (5 commits)")

---

Tags

laravelredisglidevalkey

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sinemacula-laravel-valkey-glide/health.svg)

```
[![Health](https://phpackages.com/badges/sinemacula-laravel-valkey-glide/health.svg)](https://phpackages.com/packages/sinemacula-laravel-valkey-glide)
```

###  Alternatives

[namoshek/laravel-redis-sentinel

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

39811.5k](/packages/namoshek-laravel-redis-sentinel)[monospice/laravel-redis-sentinel-drivers

Redis Sentinel integration for Laravel and Lumen.

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

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

8514.4k](/packages/yangusik-laravel-balanced-queue)[vetruvet/laravel-phpredis

Use phpredis as the redis connection in Laravel

45126.7k](/packages/vetruvet-laravel-phpredis)[ginnerpeace/laravel-redis-lock

Simple redis distributed locks for Laravel.

16119.5k](/packages/ginnerpeace-laravel-redis-lock)[byerikas/cache-tags

Allows for Redis/Valkey cache flushing multiple tagged items by a single tag.

1420.4k](/packages/byerikas-cache-tags)

PHPackages © 2026

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