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.
What it actually is. Despite the framing, this is not a Laravel package. emag-tech-labs/annotation-cache-bundle is a Symfony bundle: it registers a compiler pass against the Symfony DI container, scans configured service definitions for a @Cache annotation / #[Cache] attribute, and generates subclass proxies via ocramius/proxy-manager that wrap annotated methods in a getCached() call backed by any PSR-6 pool. There is no service provider, no facade, no Laravel container integration, and no config/cache.php awareness.
Architecture fit. The design is idiomatic Symfony and anti-idiomatic Laravel. Laravel resolves bindings at runtime through its own container and has no compiler-pass/definition-scanning phase where proxy classes could be generated; the natural Laravel equivalents are explicit decorators bound in a service provider, spatie/laravel-responsecache for HTTP-level caching, or a Cache::remember() wrapper applied at the repository/service boundary. Forcing this bundle in would mean either running a Symfony DI container inside a Laravel app (rejected) or reimplementing the annotation scan against Laravel's container (i.e., writing a new package and keeping only the idea).
Integration feasibility. Low-to-none in a Laravel codebase. In a genuine Symfony codebase it is plausible but dated: the dependency on ocramius/proxy-manager (abandoned upstream, superseded by friendsofphp/proxy-manager-lts) is the single biggest blocker, since it constrains PHP and Symfony versions. PSR-6 is also a mismatch for Laravel's cache layer, which is PSR-16-shaped — you would need an adapter or a separate pool, fragmenting cache configuration and observability.
Technical risk. High and concentrated in three areas: (1) proxy generation cannot handle final classes, final/private methods, or readonly state, turning an innocent refactor into a container compile failure; (2) implicit caching changes method semantics silently — callers cannot see that a call returns stale data, and side-effecting or non-deterministic methods become correctness bugs; (3) key derivation from serialized arguments can silently collide or blow up on non-serializable parameters (closures, entities, resources), and cache values must be serializable, which excludes a large class of realistic return types.
Key questions for the maintainer / sponsor.
Verdict. Score 2.045 with opportunity 0.38 matches reality: a niche, low-adoption, single-ecosystem tool with an aging dependency graph. Do not adopt for a Laravel product. Consider as a pattern reference only.
Stack fit. Assume a Laravel/PHP target: fit is poor. The bundle's value proposition — declarative caching without touching method bodies — is real, but Laravel already delivers 80% of it with Cache::remember() and 95% with a decorator + service provider. The remaining delta (automatic annotation scanning) is not worth a foreign container.
Recommended path: reject-and-replicate, not integrate.
composer.json of a Laravel app is dead weight plus a transitive abandoned dependency.ServiceProvider, a Cacheable trait using Cache::remember() with an explicit key builder, or HTTP-layer caching via spatie/laravel-responsecache if the need is really response caching.Migration path. There is no migration path from this bundle into Laravel — nothing to migrate. The only meaningful migration is away from implicit method-level caching toward explicit, inspectable caching at defined boundaries. If any codebase already uses the bundle, the exit path is: inventory annotated methods → replace each with an explicit decorator or Cache::remember() call → delete the bundle and its proxy artifacts → verify cache keys are namespaced and versioned.
Compatibility gates before any further investment.
ocramius/proxy-manager: disqualifying for PHP 8.1+ targets without a fork.final, private, readonly, static methods): requires coding-standard enforcement across every cached service.Sequencing (if pursued in a Symfony context).
opcache + preloading.final classes entering the annotated set.For a Laravel shop, sequencing is a single step: close the ticket with a "build internal decorator" recommendation and a one-day estimate.
Maintenance. This is the dominant cost. Last release 2023-03-30, 19 stars, 0 dependents, CI on Travis (an effectively retired platform). The dependency chain includes an abandoned proxy library. Adopting it means owning a fork or accepting a frozen, unpatchable component in the request path. In a Laravel context the maintenance burden is effectively total — you would maintain the integration glue and the abandoned transitive dependency simultaneously.
Support. No vendor, no SLA, minimal community surface (19 stars). Issue triage would land on our team. The README documents the happy path well and the failure modes poorly — no guidance on key collisions, invalidation, or proxy limitations.
Scaling. The runtime model is fine: proxies are generated at container compile time, so there is no per-request reflection overhead, and opcache handles the extra classes. Hit-rate and memory are inherited entirely from the PSR-6 pool. The scaling risk is behavioral rather than throughput: implicit caching invites over-caching, and unbounded key cardinality (keys derived from arbitrary method arguments) can silently explode a Redis instance. The Symfony compile step also grows with the number of annotated services — a deploy-time, not runtime, concern.
Failure modes to plan for.
final/private/readonly targets — surfaces as a deploy-time error, often after a refactor unrelated to caching.Ramp-up. Deceptively steep. The API is one attribute, so a developer is productive in an hour — which is the trap. Correct use requires understanding Symfony DI compiler passes, proxy-generation constraints, and cache-key design, i.e., senior-level knowledge to avoid the failure modes above. In a Laravel team, ramp-up cost is not worth paying because the idiomatic alternative is easier than the package: a decorator using Cache::remember() is comprehensible to a mid-level developer on day one and has no proxy, container, or serialization constraints.
Bottom line for the roadmap. Low opportunity score (0.38) and low overall score (2.045) are consistent with a dormant, single-ecosystem, pattern-nice/implementation-fragile tool. Recommend no adoption; capture the declarative-caching pattern as an internal one-pager and implement it with native Laravel primitives. Revisit only if the estate turns out to include Symfony services with a hard requirement for annotation-driven caching.
How can I help you explore Laravel packages today?