Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Redis Mock Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Test-Driven Development (TDD) & CI/CD Acceleration: Enables reliable, isolated Redis testing in unit/integration tests without requiring a real Redis server, reducing flakiness and speeding up test suites—now explicitly compatible with Laravel 13, ensuring alignment with the latest framework updates.
  • Cost Optimization: Eliminates the need for dedicated Redis instances in test environments, lowering infrastructure costs (e.g., cloud Redis services, local Docker setups) while maintaining compatibility with Laravel’s evolving ecosystem.
  • Local Development Flexibility: Allows developers to test Redis-dependent features (e.g., queues, caching, sessions) without external dependencies, improving onboarding and reducing "works on my machine" issues—critical for Laravel 13’s new features like improved queue workers or enhanced caching drivers.
  • Roadmap for Scalability: Supports future-proofing by mocking Redis interactions early, ensuring compatibility with Laravel’s caching, queues, and sessions—now validated for Laravel 13’s new Redis facade improvements and potential breaking changes.
  • Build vs. Buy: Justifies not building a custom mock solution (saving dev time on maintenance) while avoiding vendor lock-in, especially as Laravel 13 introduces potential Redis-related changes (e.g., [hypothetical new queue optimizations]).

When to Consider This Package

  • Adopt if:

    • Your Laravel app (now or upgrading to Laravel 13) heavily relies on Redis (e.g., queues, caching, rate limiting) and tests are flaky or slow due to external dependencies.
    • You’re using GitHub Actions, CircleCI, or other CI systems where spinning up Redis is costly or unreliable, and you want Laravel 13-specific optimizations (e.g., faster test execution).
    • Your team prioritizes TDD or needs to mock Redis for edge cases (e.g., connection failures, TTL expirations) in a Laravel 13-compatible way.
    • You’re migrating legacy apps to Laravel 13 and need to validate Redis interactions without refactoring first.
    • You want to future-proof your tests against Laravel’s evolving Redis integration (e.g., new facade methods or queue behaviors).
  • Look elsewhere if:

    • Your tests are not Redis-dependent (e.g., pure API logic with no caching/queues).
    • You’re using Redis-specific features (e.g., advanced data structures like RedisJSON) that the mock doesn’t support (verify compatibility with Laravel 13’s Redis changes).
    • Your team lacks PHP/Laravel expertise to debug mock behavior, especially with Laravel 13’s potential breaking changes in Redis-related components.
    • You’re already using a paid service (e.g., Redis Labs) with reliable test environments and no plans to upgrade to Laravel 13.

How to Pitch It (Stakeholders)

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:

  • Mock Redis failures (e.g., connection drops) in unit tests without infrastructure, fully compatible with Laravel 13’s Redis facade.
  • Isolate test environments—no more ‘Redis not running’ errors in PRs, even with Laravel 13’s new queue optimizations.
  • Simplify onboarding—new devs won’t need to configure Redis locally for Laravel 13 projects. Tradeoff: We’ll need to verify mock behavior matches our use cases (e.g., [specific Laravel 13 Redis commands]). Let’s spike it for [critical feature] first, focusing on Laravel 13-specific scenarios like [example: new caching drivers]."*

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!"*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity