Weave 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

Eloquent Redis Mirror Laravel Package

petkakahin/eloquent-redis-mirror

A Laravel package that mirrors Eloquent models into Redis, keeping cached copies in sync on save and delete so you can serve fast reads without touching the database. Drop-in setup that leaves your existing Eloquent workflow unchanged.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Read-path performance investment: Decide whether to reduce database load and read latency by adopting a Redis read-through layer for hot Eloquent models, rather than immediately scaling the database vertically or adding read replicas.
  • Roadmap acceleration: Enables read-heavy features such as catalogs, dashboards, activity feeds, and API endpoints to ship faster without building custom caching and invalidation logic.
  • Build vs. buy: Provides a drop-in Laravel trait with relation support, write-through synchronization, fault tolerance, and a substantial test suite. It is a credible alternative to an in-house cache layer, but v1.0.0 is the first stable release, so adoption should be piloted and dependency-reviewed.
  • Caching policy definition: Forces useful product/engineering decisions about which models to mirror, acceptable consistency windows, Redis memory budgets, eviction policy, and failover behavior when Redis is unavailable.
  • Use-case fit: Best suited to high-read, lower-write models accessed through standard Eloquent operations like find(), with(), first(), paginate(), and exists().
  • Operational readiness: Supports decisions around observability—cache hit rate, Redis memory/eviction, stale-read incidents, and database fallback load—before broad rollout.

When to Consider This Package

Consider adoption when:

  • The product runs Laravel 11+ / PHP 8.2+ and already operates Redis in production.
  • There are read-heavy Eloquent models with simple key lookups, eager-loaded relations, and pagination.
  • Writes to mirrored models go through Eloquent events (create/update/delete/restore), and the database remains the source of truth.
  • Near-real-time consistency is acceptable, with automatic fallback to the database if Redis is unavailable.
  • The team can pilot on one or two models, monitor cache hit rate and eviction behavior, and validate relation invalidation.
  • Relation caching for HasMany, HasOne, BelongsToMany, and BelongsTo is valuable enough to avoid custom implementation.

Look elsewhere when:

  • Strong cross-model transactional consistency is required, or reads must reflect raw SQL/bulk writes immediately.
  • Models are write-heavy or rely on complex aggregates, reporting queries, or query-builder operations outside Eloquent events.
  • Cached data contains sensitive information and Redis access controls, encryption, or retention policies are not mature.
  • The team needs a production-proven package with a long support history; v1.0.0 is stable but new.
  • Existing caching, read replicas, or CDN strategies already meet latency and database-load SLOs.
  • The application is on older Laravel/PHP versions or cannot accept a new Redis dependency in the critical read path.

How to Pitch It (Stakeholders)

For executives: This package is a drop-in Redis mirror for Eloquent models that can cut database read load and improve response times for read-heavy features. It keeps the database as the source of truth, synchronizes writes automatically through Eloquent, and falls back to the database if Redis is unavailable. The first stable release includes 324 tests and passes PHPStan at max level. Recommend a contained pilot on one high-read model with clear success metrics: p95 read latency, database CPU/read volume, Redis hit rate, and stale-read incidents.

For engineering: Adoption is low-friction—add one trait and keep the standard Eloquent API. Reads like find(), with(), paginate(), and exists() are served from Redis, while writes update Redis through model events. Relations and eager loading are supported, including custom relation mappings. Batch writes use MULTI/EXEC for atomicity, and Redis outages fall back to the database. Key caveats: cache invalidation depends on Eloquent write paths, so raw SQL and bulk query-builder writes need explicit handling; Redis memory, eviction, TTLs, and sensitive-data controls must be defined; and custom relation behavior should be tested before rollout. This is a performance layer, not a replacement for the database.

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.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib