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

Yii2 Redis Laravel Package

yiisoft/yii2-redis

Redis cache, session, mutex, and ActiveRecord support for Yii 2. Store and query structured data in Redis using a familiar ActiveRecord API, with cache and session handlers included.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for a Redis abstraction layer inside a Yii 2 codebase. This package is the official first-party extension, so the decision is largely "adopt the supported integration" rather than "write our own cache/session/mutex/ActiveRecord adapters against Redis." That saves weeks of engineering and gives us framework-native interfaces (Cache, Session, Mutex, ActiveRecord) instead of bespoke glue.
  • Infrastructure feature scoping for caching and session backends. It makes Redis a first-class option for three distinct roadmap items at once: shared cache (multi-node consistency, TTL-based eviction), centralized session storage (enables horizontal scaling and zero-downtime deploys behind a load balancer), and distributed locks (Mutex) for cron/job deduplication and single-writer guarantees.
  • A persistence escape hatch for high-churn, low-relational data. The ActiveRecord implementation lets us model structured data without adding tables or a second database engine — useful for ephemeral or access-pattern-heavy entities (counters, presence, recent-activity, queues of small records) where relational modeling would be overkill.
  • Connection and security posture decisions. The documented SSL/TLS scheme options (useSSL, scheme => 'tls', contextOptions with client certs) let us commit to encrypted Redis-in-transit for compliance-sensitive environments without custom code, and shape our managed-Redis vendor selection (TLS + password auth support is a checklist item).
  • Topology decision inputs. The Predis connection path documents standalone, Sentinel, and cluster configurations — which directly informs whether we buy a managed HA Redis or run our own, and whether cluster support is a requirement. Note the documented caveat that the Predis connection does not support the cache/session/ActiveRecord/mutex component interfaces under cluster — that constrains how aggressive we can be with a clustered topology.
  • Maintenance and lifecycle risk tracking. With modest adoption signals and a long-lived but aging framework host, this belongs on the dependency-watch list so we can sequence any migration away from Yii 2 rather than being surprised by it.

When to Consider This Package

Adopt when:

  • The application is genuinely on Yii 2 and we want Redis as cache, session store, mutex, or lightweight structured storage through official, framework-blessed interfaces.
  • We need the whole bundle — cache and session and locking — rather than a single-purpose client. Consolidating on one extension reduces dependency surface and configuration sprawl.
  • We have a PHP 7.4+ runtime and Redis 2.6.12+; both are easy to satisfy and should be verified as part of the gate.
  • We want to avoid owning a custom Redis adapter — the readme, versioned releases, and documentation make this defensible during review.

Look elsewhere when:

  • The stack is Laravel. This is a Yii 2 extension and does not apply. Laravel already ships first-party Redis support (Redis facade, predis/phpredis, cache and session drivers, Cache::lock), so there is nothing to adopt here — the equivalent decision was already made for us by the framework.
  • We need clustered Redis with cache/session/locking. Per the docs, the Predis connection supports clusters but not the component interfaces; we'd end up bypassing the value proposition.
  • Query complexity matters. The Redis ActiveRecord cannot support where(), limit(), offset(), orderBy(), or indexBy(), and via relations are unavailable. If the roadmap hints at filtering or pagination over that data, it's the wrong store — choose a relational or document database instead of rediscovering the limitation mid-build.
  • The team is planning a framework migration off Yii 2. Investing in deep coupling to Yii-specific ActiveRecord/session plumbing increases migration cost. In that case, prefer a thin, framework-agnostic Redis usage layer and treat this only as a stopgap.
  • We need vendor-backed SLAs or a large ecosystem. This is a single-maintainer-lineage, community-governed extension with modest community signals; if procurement requires commercial support, that's a gap to price in.

How to Pitch It (Stakeholders)

For executives: This is a small, no-cost, official add-on that lets our Yii 2 application use Redis for the three things we most need as we scale — shared caching, centralized sessions, and safe background-job locking. It removes a class of "write it ourselves" work and the associated long-term maintenance, and it ships with documented TLS support that helps us meet security requirements. The primary risk isn't the package; it's the underlying framework's maturity, which is already on our radar. Recommendation: adopt it as the standard Redis integration for Yii 2 services, keep it on the dependency-watch list, and do not use it as a reason to deepen investment in Yii 2 for new products.

For engineering: Use the official extension rather than hand-rolling adapters. It gives us framework-native Cache, Session, Mutex, and ActiveRecord components, plus a raw Connection for Redis-native commands when the abstractions don't fit. Configuration is standard component wiring with TLS via scheme/useSSL and optional client certs. Two constraints to design around from day one: the Redis ActiveRecord has no where/limit/offset/orderBy/indexBy support, and the Predis cluster path cannot back the cache/session/ActiveRecord/mutex components — so pick standalone or Sentinel unless we're deliberately going around those interfaces. Requirements are PHP 7.4+ (8 recommended) and Redis 2.6.12+; verify both in CI before we commit. For any Laravel service, use the framework's built-in Redis support instead — this package does not apply.

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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource