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

Cache Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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.

  • Is any part of our stack actually Symfony, or is this purely conceptual interest? If Laravel, this is a "steal the pattern, not the package" decision.
  • Does it support PHP 8.1+ / 8.2+ and Symfony 6.x, and is there a maintained proxy-manager replacement on the roadmap?
  • What is the release cadence and bus factor? Last release was 2023-03-30, 19 stars, 0 dependents, and CI still points at Travis — indicators of a dormant internal-origin project.
  • How are cache keys derived, and can they be namespaced/versioned for safe invalidation?
  • Who owns the code today?

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.

Integration Approach

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.

  1. Do not add the dependency. No Laravel service provider exists, and a Symfony bundle in composer.json of a Laravel app is dead weight plus a transitive abandoned dependency.
  2. Extract the requirement, not the package. If the goal is "caching should be declared, not scattered through business logic," the Laravel-native answers are: repository-level decorators bound in a 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.
  3. If a Symfony service genuinely exists in the estate (e.g., a polyglot monorepo), evaluate the bundle there in isolation, and only after confirming a maintained proxy-manager fork and a supported Symfony major.

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.

  • Laravel version supported: none — hard stop.
  • PHP version ceiling imposed by ocramius/proxy-manager: disqualifying for PHP 8.1+ targets without a fork.
  • PSR-6 vs PSR-16 mismatch: requires adapter, splits cache config/telemetry.
  • Proxy constraints (final, private, readonly, static methods): requires coding-standard enforcement across every cached service.

Sequencing (if pursued in a Symfony context).

  1. Spike: one non-critical service, one cache pool, verify proxy generation under the target PHP/Symfony combo and under opcache + preloading.
  2. Establish key-namespacing and TTL conventions before the second service is annotated.
  3. Add CI checks that fail the build on final classes entering the annotated set.
  4. Only then broaden to hot paths, with before/after latency and hit-rate measurement.

For a Laravel shop, sequencing is a single step: close the ticket with a "build internal decorator" recommendation and a one-day estimate.

Operational Impact

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.

  • Container compile failure from final/private/readonly targets — surfaces as a deploy-time error, often after a refactor unrelated to caching.
  • Silent staleness: methods with side effects or mutable dependencies cached as if pure; no compile-time or runtime guard.
  • Key collisions / unbounded cardinality from argument serialization.
  • Serialization failures on non-serializable return values (entities with lazy proxies, closures, resources).
  • Cache stampede on cold keys — no built-in locking or probabilistic early expiration.
  • Observability blind spot: cache hits/misses are invisible at the call site, so debugging latency regressions requires pool-level instrumentation.
  • Deploy-time proxy drift if compiled artifacts are cached across releases without invalidation.

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.

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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect