laminas/laminas-cache
Laminas Cache provides flexible caching for PHP applications, with adapters for common backends, cache storage, patterns, plugins, and PSR-compatible integrations. Includes tools for configuring, managing, and testing cache behavior in Laminas apps.
If this component is used without laminas-mvc or mezzio, a PSR-11 container to fetch services, adapters, plugins, etc. is needed.
The easiest way would be to use laminas-config-aggregator along with laminas-servicemanager.
use Laminas\Cache\ConfigProvider;
use Laminas\Cache\Service\StorageAdapterFactoryInterface;
use Laminas\Cache\Storage\Adapter\Memory;
use Laminas\ConfigAggregator\ConfigAggregator;
use Laminas\ServiceManager\ServiceManager;
$config = (new ConfigAggregator([
ConfigProvider::class,
]))->getMergedConfig();
$dependencies = $config['dependencies'];
$container = new ServiceManager($dependencies);
/** [@var](https://github.com/var) StorageAdapterFactoryInterface $storageFactory */
$storageFactory = $container->get(StorageAdapterFactoryInterface::class);
$storage = $storageFactory->create(Memory::class);
$storage->setItem('foo', 'bar');
How can I help you explore Laravel packages today?