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 Plugin Laravel Package

graham-campbell/cache-plugin

A Laravel package from Graham Campbell that adds a plugin layer to cache stores, letting you attach custom behavior to cache reads, writes, and deletes without changing the underlying driver. Useful for logging, metrics, and other cross-cutting concerns.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for outbound caching. Forces an explicit choice among three options: hand-rolled caching middleware for third-party calls, continuing to wrap every call in Cache::remember(), or adopting a thin plugin that already implements caching semantics. The decision is which of the three we standardize on, not whether we cache. Note that the supplied documentation describes two materially different products — a lightweight Laravel-compatible cache layer with pluggable stores and namespaced keys, versus an HTTPlug/PSR-18 HTTP cache plugin with freshness/revalidation/Vary handling. The first half-day of any work must confirm which one we are buying before the build-vs-buy answer is meaningful.
  • Third-party API cost and quota management. Informs roadmap and budget conversations around metered integrations (maps, geocoding, weather, enrichment, KYC, payments metadata), where a higher cache hit rate converts directly into lower vendor invoices and fewer rate-limit incidents. This is the clearest ROI lever the package offers and the one to lead with when justifying capacity.
  • Reliability budget for integrations. Supports the product decision to degrade gracefully — serving a recently cached response during a vendor outage instead of surfacing an error — converting a hard dependency into a soft one. That is a UX and reliability decision, not merely a performance tweak, and it should be framed that way in incident reviews.
  • Standardizing an integration layer. A candidate building block for a shared "external services client" so caching policy is defined once rather than reimplemented per team. Paired roadmap deliverable: a written caching policy covering what is cached, for how long, keyed how, with what tenant scoping and body-size cap.
  • Scoping caching asks correctly. Keeps three frequently conflated requests distinct — outbound HTTP client caching (in scope), server-side response caching for our own app (spatie/laravel-responsecache, Laravel cache), and edge/CDN caching (Cloudflare/Fastly). Being explicit prevents a stakeholder expecting page-speed wins from an API-cost change.
  • Prioritizing enablement work. Frames this as low-visibility infrastructure with measurable cost and latency impact — useful for defending engineering capacity, and equally useful for deferring it if a spike shows no meaningful savings over an internal wrapper.
  • Not a differentiator. This is plumbing. Evaluate on operational ROI — spend reduced, incidents avoided, engineering days saved — never on user-facing value.

When to Consider This Package

Consider it when:

  • Your service makes outbound HTTP calls through PSR-18/HTTPlug or Guzzle clients — queue workers, cron jobs, SDK-style clients — and the same read-heavy, idempotent GETs repeat within minutes.
  • You already run a PSR-6 cache pool (Redis, Memcached, filesystem) and want responses persisted there with predictable keys and TTLs.
  • You want "good defaults" on day one — sensible key generation, respect for upstream cache headers, storage-agnostic behavior — without building a per-endpoint policy engine.
  • The spend or rate-limit exposure on a few integrations is large enough that a modest hit-rate improvement pays for the work.
  • You want a thin, composable plugin reusable across Laravel and standalone PHP services, and you are willing to own a small wrapper around it.

Look elsewhere when:

  • You need application response or full-page caching — use Laravel's cache, spatie/laravel-responsecache, or an edge layer.
  • You need advanced invalidation — tag-based purging, per-tenant eviction, dependency graphs, cache warming. This is a plugin, not a caching platform.
  • You need first-class observability (hit/miss metrics, tracing, structured logs) out of the box; you will instrument it yourself.
  • You are not on Guzzle/PSR-18, or you need it to drop onto the Http facade without integration work. The HTTP-flavored integration decorates a PSR-18 client via PluginClient, and Laravel's cache repository is not PSR-6 — both require deliberate wiring (a pool adapter, a custom client binding, or an internal service wrapper). None of it is hard; none of it is composer require and forget.
  • You need request coalescing, circuit breaking, retry/backoff, or thundering-herd protection — complementary concerns the plugin does not address.
  • You need maintenance guarantees and a support community. With zero dependents and a negligible score, treat adoption as a technical bet: confirm PHP/PSR version constraints and release cadence, and keep a fork-or-reimplement exit. The surface area is small enough (~50–100 lines of equivalent behavior) that this hedge is cheap.

How to Pitch It (Stakeholders)

For executives (one paragraph): A meaningful share of our outbound traffic to paid and rate-limited third-party APIs is redundant — the same data requested repeatedly within minutes. This package is a small caching layer for our HTTP client that stores those responses and reuses them, honoring the provider's own cache instructions. The business case is concrete: lower vendor API spend, faster page and job execution, and fewer user-visible failures during a vendor outage because we can serve recently cached data instead of an error. It is infrastructure, not a customer-facing feature — cheap to adopt, easy to remove, and measured in reduced invoices and avoided incidents rather than new functionality. Three caveats to state plainly: adoption and community maturity are low, so we adopt behind our own abstraction with a documented exit; the documentation is ambiguous about exactly which product this is, so the first deliverable is a half-day verification rather than a build; and the highest-severity risk is cache-key safety across tenants, mitigated with a written caching policy and review before promotion beyond pilot.

For engineering (the short version): Treat this as a time-boxed experiment, not a platform commitment. Step one is a half-day resolution spike to confirm from composer.json and src/ whether this is the HTTPlug/PSR-18 cache plugin or a Laravel-flavored cache layer — the supplied materials describe both, and the integration story, estimate and risk profile differ materially. Assuming the HTTP-cache variant: it is HTTP-compliant response caching plugged into any PSR-6 pool we already run, not a Laravel cache driver. Inside Laravel the friction is structural — the Http facade is Guzzle-native while this decorates a PSR-18 client, and Laravel's cache is not PSR-6 — so we need a pool adapter plus one small typed service rather than a drop-in. Recommended path: build one bounded client class behind our own interface, pilot on a single high-volume read-only integration with generous TTLs and a kill switch, and measure hit rate, latency and vendor spend before and after. Add our own metrics and tracing — observability is not included — and write the caching policy (keys, TTLs, tenant scoping, no-store/private behavior, max body size) before scaling, since mis-keyed responses are the real blast radius. Also budget a small test-harness line item: swapping the client can silently bypass Http::fake() in existing tests. If the spike shows an internal wrapper is comparable in effort, default to "borrow the pattern, own the code" and drop the dependency — reversibility is the strongest argument for running the pilot at all.

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.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core