josiasmontag/laravel-redis-mock
Drop-in Redis mock for Laravel tests using Redis PHP Mock. Adds a “mock” Redis client so you can run test suites without a running Redis server. Enable via REDIS_CLIENT=mock in .env.testing/phpunit.xml; works with Testbench for package dev.
Adopt if:
Look elsewhere if:
For Executives: "This package now supports Laravel 13, letting us test Redis-dependent features 10x faster and cheaper by eliminating real Redis servers in CI. For example, our queue tests (now using Laravel 13’s optimized workers) currently take 2 minutes with Dockerized Redis—this cuts that to seconds. It also reduces cloud costs by $X/month (estimate: [Y]). Low risk (MIT license, active maintenance), high ROI for scaling, and future-proofed for Laravel’s latest updates."
For Engineering: *"We can now:
For Developers:
*"No more Service Unavailable errors in your Laravel 13 tests! This package replaces Redis with a fake in-memory version. Example:
// Before: Flaky test (even with Laravel 13)
public function test_queue_job() {
$this->artisan('queue:work')->assertExitCode(0); // Needs real Redis
// After: Reliable (Laravel 13-compatible)
public function test_queue_job() {
$this->mockRedis->shouldReceive('rpop')->andReturn('job:1');
$this->artisan('queue:work')->assertExitCode(0); // Instant!
}
Pro tip: Use it for Laravel 13’s new caching tests too—just mock get()/set() calls. Works seamlessly with the updated facade!"*
How can I help you explore Laravel packages today?