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

Redis Mock Laravel Package

m6web/redis-mock

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Test-Driven Development (TDD) for Redis-Dependent Features: Enables reliable unit/integration testing for Laravel applications using Redis (e.g., caching, sessions, queues, rate limiting, or real-time features like WebSockets). Reduces flakiness in CI/CD pipelines by eliminating dependency on a live Redis server.
  • Build vs. Buy: Avoids reinventing a Redis mock from scratch, saving engineering time. Justifies adoption over alternatives like Dockerized Redis in tests (slower, more resource-intensive).
  • Roadmap for Observability/Performance Features: Supports testing Redis-backed metrics (e.g., DBSIZE, EXPIRE) critical for monitoring tools or auto-scaling logic. Aligns with initiatives to improve system reliability.
  • Use Cases:
    • Caching Layers: Test cache hit/miss logic without external dependencies.
    • Queue Systems: Mock job processing (e.g., DEL for completed jobs) in Laravel queues.
    • Session Management: Validate session storage/retrieval flows.
    • Rate Limiting: Simulate token bucket or fixed-window algorithms.
    • Real-Time Systems: Mock pub/sub or sorted sets for feature flags or leaderboards.

When to Consider This Package

  • Adopt if:

    • Your Laravel app heavily relies on Redis for core functionality (e.g., >30% of critical paths).
    • Tests frequently fail due to Redis connection issues or state pollution (e.g., shared test databases).
    • You prioritize speed in CI/CD (mock is ~100x faster than a real Redis instance).
    • Your team uses Predis (the package only supports this client; other clients like phpredis require alternatives).
    • You need deterministic testing (e.g., for financial systems or compliance audits).
  • Look elsewhere if:

    • Your Redis usage is minimal (e.g., only for analytics or non-critical features).
    • You use phpredis or another Redis client (consider RedisPHPMock or Dockerized Redis).
    • You require advanced Redis features (e.g., Lua scripting, RedisJSON, or modules like RediSearch) not mocked here.
    • Your team lacks PHP 7.1+ compatibility (package is outdated; evaluate maintenance risk).
    • You need distributed testing (mock is single-process; sharded Redis setups may not translate).

How to Pitch It (Stakeholders)

For Executives: "This package lets us test Redis-dependent features 100x faster than using a real server, cutting CI/CD bottlenecks and reducing flaky test failures. For example, if our checkout flow relies on Redis for rate limiting, we can now verify edge cases (e.g., DECRBY failures) in seconds—not minutes. It’s a low-risk, high-reward investment to accelerate development and improve reliability, especially as we scale features like real-time notifications or caching layers. The MIT license and active GitHub community mitigate risk."

For Engineering: *"RedisMock solves our biggest test pain point: flaky Redis dependencies. Instead of spinning up a Docker container for every test or fighting connection timeouts, we can mock commands like GET, DEL, and EXPIRE in-memory. This is critical for:

  • Queue tests: Verify job processing without enqueuing real jobs.
  • Cache invalidation: Test FLUSHDB or TTL logic deterministically.
  • Session handling: Mock SET/GET for user auth flows. The tradeoff is limited to Predis (we’d need to confirm our client), but the speedup justifies it. Let’s prototype it for our caching layer first—if it works, we can expand to queues and sessions."*
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.
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours