cache/tag-interop
Provides two interoperable interfaces that add tag support to PSR-6 caching, enabling consistent tagging and invalidation across cache implementations. Built by contributors from Symfony, PHP-Cache, and Drupal; MIT licensed and installable via Composer.
Start by installing the package via Composer (composer require cache/tag-interop). This package provides only interfaces—no concrete implementations—so it must be used alongside a cache pool that supports tagging (e.g., cache/file-filesystem, cache/array-adapter with tagging support, or custom pools implementing the interfaces). First, locate the two core interfaces: Cache\TagInterop<TaggableCacheItemPoolInterface> (extends PSR-6’s CacheItemPoolInterface) and Cache\TagInterop<TaggableCacheItemInterface> (extends PSR-6’s CacheItemInterface). These extend PSR-6 with optional tagging capabilities (tag(), invalidateTags()), enabling developers to build tag-based cache invalidation strategies—e.g., busting all cache items related to a "user:123" or "product:456" tag on updates.
->tag('entity:type:123') before save().invalidateTags(['user:123', 'theme:dark']) on a tagged pool to clear related entries without knowing individual keys.Cache\Store implementations or in Symfony with cache.adapter.taggable services—integrate via factory or decorator.TaggableCacheItemPoolInterface type-hinted services for testability; mock tagging behavior in unit tests.composer require cache/tag-interop alone won’t give tagging behavior—you must pair it with a tagged-capable pool (e.g., php-cache/file-filesystem v1.2+).instanceof TaggableCacheItemPoolInterface before calling tag() or invalidateTags().var_dump(get_class($pool)) to confirm the pool implements the interface; invalidateTags() silently fails on non-tagged pools—check logs for null returns.class MyPool implements TaggableCacheItemPoolInterface) and manage tag→keys mappings manually in save(), invalidateTags().Cache\TagInterop\ namespace (not Cache\Taggable\*)—the codebase is stable but deprecated in favor of upcoming PSR-6 extensions.How can I help you explore Laravel packages today?