Laminas filesystem cache usage

Greetings, I’m trying to use file cache in my app. Steps I’m doing:

  • require laminas/laminas-cache-storage-adapter-filesystem
  • adding section to my autoload/
'filesystem' => [
            'name' => 'filesystem',
            'options' => [
                'cache_dir' => __DIR__ . '/../../data/cache',
            'plugins' => [
                    'name' => 'serializer',
                    'options' => [
  • in confg.php I’m including ConfigProvider:
$aggregator = new ConfigAggregator([

and getting error:

[16-Aug-2023 09:57:49 UTC] PHP Fatal error:  Uncaught Laminas\ConfigAggregator\InvalidConfigProviderException: Cannot read config from Laminas\Cache\Storage\Adapter\Filesystem\ConfigProvider - class cannot be loaded. in /var/www/vendor/laminas/laminas-config-aggregator/src/InvalidConfigProviderException.php:19

Stack trace:
#0 /var/www/vendor/laminas/laminas-config-aggregator/src/ConfigAggregator.php(113): Laminas\ConfigAggregator\InvalidConfigProviderException::fromNamedProvider()
#1 /var/www/vendor/laminas/laminas-config-aggregator/src/ConfigAggregator.php(230): Laminas\ConfigAggregator\ConfigAggregator->resolveProvider()
#2 /var/www/vendor/laminas/laminas-config-aggregator/src/ConfigAggregator.php(82): Laminas\ConfigAggregator\ConfigAggregator->loadConfigFromProviders()
#3 /var/www/config/config.php(62): Laminas\ConfigAggregator\ConfigAggregator->__construct()
#4 /var/www/config/container.php(8): require('...')
#5 /var/www/public/index.php(18): require('...')
#6 /var/www/public/index.php(30): {closure}()

Hello and welcome to our forums! :smiley:

It looks like you do not use the automated configuration via the component installer; see:

This makes no sense because it is a duplication and not needed. Check the related tutorial:

My bad, pasted wrong part, edited already :grinning:

Do you use laminas-mvc or Mezzio?

I’m using Mezzio.

So I don’t understand why I’m getting error after adding \Laminas\Cache\Storage\Adapter\Filesystem\ConfigProvider::class to ConfigAggregator
but before that I already used \Laminas\Cache\Storage\Adapter\Redis\ConfigProvider::class and did’t get any errors.

The name of the class looks good.
Please recheck that the folder with laminas/laminas-cache-storage-adapter-filesystem is present in the vendor directory of your application.

Seems the problem was with the composer. Thanks.

Thank you for the feedback. :+1: