emag-tech-labs/annotation-cache-bundle
Symfony bundle that adds annotation or PHP 8 attribute based caching to service method responses. It scans services, generates proxy classes, and stores results in any PSR-6 cache implementation such as Redis, Memcache, or a simple array.
Verdict up front: do not adopt. This is a Symfony bundle, not a Laravel package, and the mechanism it relies on has no equivalent in Laravel's runtime container. For a Laravel roadmap item the correct read is "pattern reference, not dependency." For a Symfony shop it is a maybe that must clear a maintenance and dependency-health bar it currently fails.
Architecture fit
@Cache annotation / #[Cache] attribute, then redefines each annotated service to point at a generated proxy subclass (via ocramius/proxy-manager) that mixes in a cache trait and overrides the annotated methods.Bundle, no DependencyInjection\CompilerPass, no services.yaml. The port would be a rewrite, not an integration.Illuminate\Contracts\Cache\Repository). Bridging means pulling in symfony/cache or a PSR-6 adapter — new dependency surface to reproduce a capability Laravel already expresses as Cache::remember($key, $ttl, fn () => ...).final classes and methods cannot be subclassed, private methods are invisible to the override, self::/static:: calls bypass the proxy, and PHP 8.1+ readonly properties plus constructor promotion interact badly with subclass instantiation.Integration feasibility
composer.json allows symfony/framework-bundle ^6.4|^7. Last release is 2023-03-30; the Doctrine annotations pathway it was originally built on was deprecated in Symfony 5.4 and removed from the default stack in 6+.Technical risk
ocramius/proxy-manager is archived; the maintained successor is friendsofphp/proxy-manager-lts. Whether this bundle uses the live fork is a first-order question.Key questions (answer these from source review before any further spend)
composer.json permit? Does it run on Symfony 6.4 / 7?ocramius or friendsofphp/proxy-manager-lts?doctrine/annotations removed, or is the PHP 8 attribute path the only viable one?final classes, interfaces, and readonly properties, or does it fail silently at build?Stack fit
| Laravel primitive | What the bundle expects | Gap |
|---|---|---|
AppServiceProvider::register() |
Symfony Bundle + extension |
No entry point |
| Runtime container resolution | Compile-time CompilerPass + definition rewrite |
No equivalent phase |
Cache::remember() (PSR-16) |
PSR-6 CacheItemPoolInterface |
Adapter required |
$this->app->extend() decorators |
Generated subclass proxies | Different mechanism |
php artisan config:cache |
Symfony container dump | Not comparable |
Recommended path: extract the pattern, not the package.
#[Cache(ttl: ..., key: ...)] PHP 8 attribute in-house. Attributes are the future-proof half of this package's idea and cost nothing to own.CachingDecorator implementing the same interface as the target service, bound in a service provider, is testable, greppable, and has no final/readonly constraints. Where decoration is awkward, use Cache::remember() at the call site — it is one line and has zero onboarding cost.$this->app->extend() or a Resolving callback that wraps the concrete — a fraction of the complexity of compile-time codegen.Migration path — there is no migration, because there is no current state to migrate from. Frame the work as a reusable internal capability (2–3 day spike + tests), not a package adoption.
Compatibility — if a Symfony codebase is in scope, pin friendsofphp/proxy-manager-lts, verify against Symfony 6.4 LTS, and vendor-patch the proxy factory. Do not proceed on Symfony 7.
Sequencing
Maintenance. This is the decisive factor. A 19-star package with zero dependents and a March 2023 release has an effective maintainer count of zero from your perspective. Adopting it means forking it, and a fork means you own the proxy generation, the annotation parsing, and the Symfony-version compatibility matrix forever. That is a permanent tax for a capability worth a few hundred lines of your own code. The Travis CI badge indicates the build pipeline is no longer exercised — treat "green" as unknown, not passing.
Support. No community, no Stack Overflow corpus, no answerable issue queue. The publishing vendor is an e-commerce company that open-sourced internal tooling; there is no commercial support path and no incentive to triage a stranger's Symfony 7 upgrade.
Scaling.
Failure modes to plan for
SerializationException on a code path that worked before instrumentation.final class, PHP version drift) → container will not boot; whole-app outage from a caching nicety.Ramp-up. Every engineer who touches an annotated service must understand the annotation semantics, the proxy indirection, and the key-derivation rules before they can reason about behaviour. That is a real onboarding cost, paid repeatedly, for a package with no documentation beyond a README and no community to ask. Against Cache::remember(), which a new hire understands in thirty seconds, the trade is indefensible.
Bottom line for the roadmap: capture the idea — declarative, attribute-driven method caching — as an internal convention with a thin, owned implementation. Decline the dependency. If a Symfony service genuinely needs it, run the eight key questions first and treat a fork as the default outcome.
How can I help you explore Laravel packages today?