emag-tech-labs/cache-bundle
Annotation Cache Bundle lets you cache Symfony service method responses using a simple annotation or PHP 8 attribute. It proxies annotated services and stores results in any PSR-6 cache (array, Redis, Memcache), returning cached data automatically on repeat calls.
ocramius/proxy-manager, and PHP 8 attributes. If our target surface is Laravel, this is a non-starter and the decision is a straight "no"; if we maintain Symfony services, it becomes a narrow legacy-modernization question. Confirm the stack before spending any evaluation budget.symfony/cache TagAwareAdapter) — the former is a velocity play, the latter an operational one.ocramius/proxy-manager's successor is friendsofphp/proxy-manager-lts). Adopting it is a concrete test case for whether our dependency policy tolerates unmaintained, single-maintainer libraries — a decision we will otherwise keep relitigating.Consider it only when all of the following hold:
Cache facade or middleware).CacheInterface and hand-roll keys is a real cost, and an annotation/attribute drop-in buys measurable time.Look elsewhere — or build nothing — when:
Cache::remember, response-cache middleware, or route-level cache middleware instead.#[Cache] attribute plus symfony/cache contracts; adopting a third-party annotation bundle for the same job adds risk for no capability.TagAwareAdapter explicitly.symfony/http-cache / Varnish is the correct layer, not service proxies.For executives: A small open-source caching add-on that lets developers mark service methods and get caching automatically, instead of writing cache lookups by hand. It could save a few days of boilerplate on the right kind of legacy app. It is not a strategic adoption: roughly 19 stars, no downstream projects relying on it, and no release since March 2023. Recommendation is to treat it as a design reference and a one-sprint spike at most — the expected saving is modest and the carrying cost (we own the code, plus a deprecated proxy library) is real. Modern frameworks now cover this natively, so the durable answer is to standardize caching on the framework's built-in mechanism rather than adopt a niche package.
For engineering: The mechanism is a compile-time scan of service methods for a cache attribute, generation of a proxy-manager subclass per service, and an overridden getCached call that derives a key and reads/writes any PSR-6 pool. The idea is sound and readable; the implementation is not something we should depend on. Concrete risks: ocramius/proxy-manager is superseded by friendsofphp/proxy-manager-lts, so Composer conflicts are likely on modern PHP; proxies on services interact badly with final classes and typed properties; and the per-method key scheme gives us no tag-based invalidation. If we want this ergonomics, the two viable routes are (1) Symfony's native #[Cache] attribute on 6.4+/7.x, or (2) ~150 lines of our own attribute plus a decorator, which we fully control. If we proceed with a spike anyway, vendor the source, pin it, and put a removal ticket on the board at the same time.
For the framework decision-makers: Note the mismatch explicitly — this is a Symfony bundle, so it does not apply to a Laravel roadmap. If the question behind the question is "how do we get cheap, consistent caching across services," answer it with a team-level convention and the framework's native primitives; do not answer it with a package at this maturity level.
How can I help you explore Laravel packages today?