phpnomad / symfony-cache-integration
Package info
github.com/phpnomad/symfony-cache-integration
pkg:composer/phpnomad/symfony-cache-integration
Requires
- symfony/cache: ^7.1
Requires (Dev)
- phpnomad/tests: ^0.1.0
This package is auto-updated.
Last update: 2026-04-10 02:12:37 UTC
README
phpnomad/symfony-cache-integration adapts Symfony's Cache component to phpnomad/cache's CacheStrategy contract. It ships a single strategy, SymfonyFileCache, backed by Symfony's FilesystemAdapter. Your application code still depends only on the CacheStrategy interface, so the Symfony-specific wiring stays at the bootstrap layer and never leaks into the services that read and write cached values.
Installation
composer require phpnomad/symfony-cache-integration
What This Provides
SymfonyFileCache, aCacheStrategyimplementation backed by Symfony'sFilesystemAdapter. It gives you a filesystem-backed persistent cache that satisfies thephpnomad/cachecontract (get,set,delete,exists,clear) and throwsCachedItemNotFoundExceptionon a miss, so consumers can catch the exception and fall back to their source of truth.
Requirements
phpnomad/cachefor theCacheStrategyinterface and theCachedItemNotFoundExceptionthis package throwssymfony/cache^7.1, the Symfony Cache component this package wraps- PHP 8.2 or newer, inherited from
symfony/cache^7.1
Usage
Register SymfonyFileCache as the concrete implementation of CacheStrategy in one of your application's initializers. The container then resolves any service that type-hints CacheStrategy to the filesystem-backed adapter.
<?php namespace MyApp\Bootstrap; use PHPNomad\Cache\Interfaces\CacheStrategy; use PHPNomad\Loader\Interfaces\HasClassDefinitions; use PHPNomad\Symfony\Component\CacheIntegration\Strategies\SymfonyFileCache; final class AppInitializer implements HasClassDefinitions { public function getClassDefinitions(): array { return [ SymfonyFileCache::class => CacheStrategy::class, ]; } }
Pass AppInitializer to your Bootstrapper alongside the rest of your initializers and the binding takes effect when load() runs.
Documentation
Full PHPNomad documentation lives at phpnomad.com. For the underlying caching layer, see the Symfony Cache component documentation.
License
Licensed under the MIT License.