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

symfony/cache

Symfony Cache provides fast, low-overhead PSR-6 and PSR-16 caching with adapters for popular backends, plus Symfony cache-contracts CacheInterface and TagAwareCacheInterface support.

View on GitHub
Deep Wiki
Context7

Provides extended PSR-6, PSR-16 (and tags) implementations

Frequently asked questions about Cache
Is symfony/cache compatible with Laravel's Cache facade and CacheManager?
Yes. The package ships optimized PSR-6 cache pools, a PSR-16 adapter, and implementations that align with the abstractions Laravel's cache layer already uses internally. You can register its adapters through Cache::extend() in a service provider so the Cache facade and CacheManager keep working unchanged. Existing code that calls Cache::remember(), Cache::put(), or a named store continues to work once the underlying adapter is swapped.
How do I install and configure symfony/cache in a Laravel application?
Install it with composer require symfony/cache; Laravel 10 and later already ship Symfony components, so the package usually resolves without conflicts. Then either add an adapter class to a store definition in config/cache.php or bind a custom driver in AppServiceProvider using Cache::extend('redis', ...). Because the adapters implement PSR-6 pools, wrap them in a cache store repository before exposing them through the facade.
What is the difference between the PSR-6 and PSR-16 implementations in symfony/cache?
PSR-6 is the pool and cache-item API, where you fetch an item, set its value and expiry, then save it explicitly, which allows features like tags and deferred saves. PSR-16 is the simpler get, set, and delete interface and is exposed through an adapter that wraps a PSR-6 pool. Use PSR-6 when you need tag invalidation or fine-grained control, and PSR-16 for straightforward key-value caching.
Which Laravel and PHP versions does symfony/cache support?
Laravel 10 and later bundle Symfony 6.4 or newer, so symfony/cache aligns naturally with those releases. Laravel versions below 8 may require adapter shimming because of older Symfony dependency constraints. Because Symfony ships minor releases such as 8.1.x, pin a version in composer.json and review upgrade notes before bumping to avoid breaking changes.
How do I use tag-aware caching for Eloquent models and routes in Laravel?
Wrap your backend pool in TagAwareAdapter and save items with the tags you want to invalidate later, such as a model class name or a route identifier. Calling invalidateTags() then clears every entry carrying that tag, which suits route caching, config caching, and model-level invalidation. Laravel's built-in file and redis stores do not support tags natively, so this is one of the main reasons to add symfony/cache to a project.
Should symfony/cache replace Laravel's default cache stores or run alongside them?
Running it alongside Laravel's native stores is usually the safer first step, for example adding a tagged store for advanced invalidation while keeping defaults for everything else. Replacing the redis or file driver outright is possible via Cache::extend(), but features such as Cache::lock() rely on Laravel's own store implementations and need testing first. A phased migration lets you benchmark and roll back without touching every cache call site.
Which cache backends does symfony/cache support?
It ships adapters for Redis, Memcached, APCu, Doctrine DBAL, and the filesystem, plus array and null adapters for testing. ChainAdapter lets you stack multiple backends so a fast in-memory layer falls back to a persistent one. That makes it easy to mirror Laravel's store fallback patterns for high-throughput reads.
How do I test symfony/cache integration in a Laravel app?
Use the ArrayAdapter or NullAdapter in unit tests so cache operations stay in memory and never touch Redis or the filesystem. For integration tests, assert that tags invalidate as expected and that expiry values survive the wrapper around the pool. It is also worth running the cache:clear command in staging to confirm your custom adapters are handled correctly.
Will symfony/cache's locking conflict with Laravel's Cache::lock()?
They are separate implementations: Laravel's atomic locks come from its own cache stores, while symfony/cache adds stampede protection through LockRegistry. Mixing both in one store can produce confusing behaviour, such as two different processes believing they hold the same lock. If you rely on Cache::lock(), keep that store on a native Laravel driver or write a wrapper that arbitrates between the two.
Is symfony/cache fast enough for high-traffic Laravel apps and what are the alternatives?
The component is built for low overhead, but complex setups such as ChainAdapter across several backends can add latency, so benchmark against your current store before switching. Watch dependency bloat too, since installing it can pull in related Symfony packages that must fit your Composer constraints. Alternatives include Laravel's native cache drivers, spatie/laravel-cache, and tag-enabled packages such as stichkin/laravel-cache-tagging if you only need invalidation.
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.
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
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo