Weave Code
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

Zend Cache Laravel Package

zendframework/zend-cache

zendframework/zend-cache provides flexible caching for PHP apps with multiple storage backends (filesystem, memory, APCu, Redis, and more). Supports cache patterns, plugins, serialization, and configurable adapters to improve performance and reduce repeated work.

View on GitHub
Deep Wiki
Context7

Getting Started

zend-cache is a mature but archived caching library from the Zend Framework ecosystem, now maintained under Laminas. To begin:

  • Install via Composer: composer require laminas/laminas-cache (the package was migrated to laminas/laminas-cache after Zend Framework end-of-life)
  • Understand the core abstraction: Laminas\Cache\Storage\StorageInterface and the built-in adapters (Filesystem, Memory, Apcu, Redis, Memcached)
  • Start with Filesystem storage: StorageFactory::factory(['adapter' => 'filesystem', 'options' => ['directory' => '/tmp/cache']])
  • Use the high-level Laminas\Cache\Service\StorageAdapterAbstractServiceFactory for integration with Laravel’s service container

Implementation Patterns

  • Cache service pattern: Create a dedicated cache service class that wraps the storage adapter, injecting it via Laravel’s dependency injection
  • Tag-based expiry: Enable the TaggableStorageInterface (e.g., with Filesystem adapter) to invalidate groups of cache items by tags ($storage->invalidateTags(['user_data']))
  • Centralized configuration: Define cache settings in config/cache.php, mapping Laravel’s cache.stores to Laminas adapters where possible (e.g., use redis store → redis adapter with Laravel’s redis client)
  • Direct usage in services: For high-performance or complex logic (e.g., caching DTOs, query results), inject the storage adapter directly instead of relying on Laravel’s cache facade
  • Bridge Laravel cache: Use Laminas\Cache\Storage\Adapter\StreamWrapper or custom wrapper to make Laminas adapters work with Laravel’s Cache::driver() if needed

Gotchas and Tips

  • No active maintenance: Confirm compatibility with PHP 8.0+—some older adapters may fail on newer PHP versions; manually patch if needed or prefer laminas/laminas-cache 2.12+
  • Serializer conflicts: The default serializer (phpserialize) doesn’t work well with Laravel’s serialized models; use igbinary or json via adapter options (['serializer' => 'json'])
  • Tag performance: Filesystem tags use hidden files per tag; for high-volume tag invalidation, consider Redis instead
  • Cache metadata: Use getMetadata($key) to inspect TTL, mtime, and tags—useful for debugging stale or expired entries
  • Laravel integration gap: This package doesn’t integrate out-of-the-box with Laravel’s cache system, so avoid mixing with Cache::remember() unless you manually bridge adapters—prefer one system for consistency
  • Extension point: Extend Laminas\Cache\Storage\Adapter\AbstractAdapter for custom storage backends (e.g., custom Laravel DB store), implementing setOptions() and _processOptions() carefully
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport