sinemacula / laravel-valkey-glide
Laravel Redis driver and adapter for Valkey GLIDE (ext-valkey_glide).
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 1
Open Issues: 0
pkg:composer/sinemacula/laravel-valkey-glide
Requires
- php: ^8.3
- illuminate/redis: ^11.0 || ^12.0
Requires (Dev)
- brianium/paratest: ^7.8
- friendsofphp/php-cs-fixer: ^3.85
- orchestra/testbench: ^9.0 || ^10.0
- phpstan/extension-installer: ^1.4
- phpstan/phpdoc-parser: ^2.2
- phpstan/phpstan: ^2.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.5.3
- slevomat/coding-standard: ^8.20
- squizlabs/php_codesniffer: ^3.13
Suggests
- ext-valkey_glide: Required when using the valkey-glide Redis client in runtime environments.
This package is auto-updated.
Last update: 2026-02-22 13:11:16 UTC
README
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
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
- Service provider registration of the
valkey-glidedriver viaRedisManager::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
SETandEVALcommand argument shapes - External test lane for extension and real Redis connectivity validation
Requirements
- PHP
^8.3 - Laravel components with
illuminate/redis^11.0 || ^12.0 ext-valkey_glidein 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
composer require sinemacula/laravel-valkey-glide
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
The connector normalizes Laravel config into GLIDE connect arguments:
host/port->addressesaddresses(array) ->addressestlsorscheme=tls->use_tls=trueusername+password-> ACL credentialsiamblock -> IAM credentials +use_tls=truedatabase->database_idname->client_name
Cluster-style configs are normalized into seed addresses using connectToCluster().
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 viarawcommand- Phpredis-style
SET/EVALargument shapes are normalized throughrawcommand disconnect()delegates to GLIDEclose()
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/EVALSHAkey segments
Testing
Default tests (deterministic, no local Redis required):
composer test
Coverage report:
composer test-coverage
External extension/Redis tests:
composer test-external
Current 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
Optional env vars for external tests:
VALKEY_GLIDE_TEST_HOSTVALKEY_GLIDE_TEST_PORTVALKEY_GLIDE_TEST_TLSVALKEY_GLIDE_TEST_USERNAMEVALKEY_GLIDE_TEST_PASSWORD
Development
composer install
composer format
composer check -- --all --no-cache --fix
composer test
Contributing
Contributions are welcome via GitHub pull requests.
Security
If you discover a security issue, please contact Sine Macula directly rather than opening a public issue.
License
Licensed under the Apache License, Version 2.0.