# Configuration must contain a "adapter" key in StorageAdapterFactory.php

**URL:** <https://discourse.laminas.dev/t/configuration-must-contain-a-adapter-key-in-storageadapterfactory-php/2855>\
**Category:** Components & MVC\
**Tags:** laminas-cache\
**Created:** [April 21, 2022, 6:46am UTC](https://discourse.laminas.dev/t/configuration-must-contain-a-adapter-key-in-storageadapterfactory-php/2855 "2022-04-21T06:46:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielriveraayala](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/danielriveraayala/32/1292_2.png) [@danielriveraayala](https://discourse.laminas.dev/u/danielriveraayala)\
**Post date:** [April 21, 2022, 6:46am UTC](https://discourse.laminas.dev/t/configuration-must-contain-a-adapter-key-in-storageadapterfactory-php/2855/1 "2022-04-21T06:46:24Z")

</div>

Al momento de actualiza laminas/laminas-cache a la versión ^3.1.3 me arrojado el siguiente error:

` **Fatal error** : Uncaught InvalidArgumentException: Configuration must contain a "adapter" key. in StorageAdapterFactory.php`

Mi configuración en global.php es la siguiente:

```auto
'caches' => [
        'FilesystemCache' => [
            'adapter' => [
                'name' => Filesystem::class,
                'options' => [
                    // Store cached data in this directory.
                    'cache_dir' => './data/cache',
                    // Store cached data for 1 hour.
                    'ttl' => 60 * 60 * 1
                ],
            ],
            'plugins' => [
                [
                    'name' => 'serializer',
                    'options' => [
                    ],
                ],
            ],
        ],
    ],

```

En versiones anteriores esta configuración me funcionaba correctamente pero ahora no, alguna solución??

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [April 21, 2022, 6:49am UTC](https://discourse.laminas.dev/t/configuration-must-contain-a-adapter-key-in-storageadapterfactory-php/2855/2 "2022-04-21T06:49:52Z")

</div>

Please rewrite your post in English, otherwise not everyone will understand your question.  
Thanks in advance! 👍🏼

---

<div class="post-metadata">

**Author:** ![tokstar](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@tokstar](https://discourse.laminas.dev/u/tokstar)\
**Post date:** [May 19, 2022, 10:21pm UTC](https://discourse.laminas.dev/t/configuration-must-contain-a-adapter-key-in-storageadapterfactory-php/2855/3 "2022-05-19T22:21:38Z")

</div>

I found this post and having same issue, so let me carry on. This application built with ZF3 and migrated to Laminas already. And now we have to make it to work on PHP8. Originally we had config like this

```auto

'caches' => [
        'FilesystemCache' => [
            'adapter' => [
                'name' => Filesystem::class,
                'options' => [
                    // Store cached data in this directory.
                    'cache_dir' => './data/cache',
                    'ttl' => 100
                ],
            ],
            'plugins' => [
                [
                    'name' => 'serializer',
                    'options' => [
                    ],
                ],
            ],
        ],
    ],

```

Then, having " Configuration must contain a adapter key" error, changed config like below,

```auto
'caches' => [
        'FilesystemCache' => [
            'adapter' => \Laminas\Cache\Storage\Adapter\Filesystem::class,
            'options' => [
                // Store cached data in this directory.
                'cache_dir' => './data/cache',
                'ttl' => 60*60*1
            ],
            'plugins' => [
                [
                    'name' => 'serializer',
                    'options' => [
                    ],
                ],
            ],
        ],
    ],

```

now I get error says  
‘Unable to resolve service “Laminas\Cache\Storage\Adapter\Filesystem” to a factory; are you certain you provided it during configuration?’  
and don’t know how to add Filesystem Factory since there is no factory file provided.

Please someone give us advice. Thanks!!

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [May 20, 2022, 6:28am UTC](https://discourse.laminas.dev/t/configuration-must-contain-a-adapter-key-in-storageadapterfactory-php/2855/4 "2022-05-20T06:28:44Z")

</div>

Hello and welcome to our forums! 😃

> [@tokstar](#):
>
> Then, having " Configuration must contain a adapter key" error, changed config like below,

These are the correct changes for version 3 of laminas-cache.

See documentation:

> **[Adapters - laminas-cache - Laminas Docs](https://docs.laminas.dev/laminas-cache/v3/storage/adapter/#quick-start)**
>
> Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output.

Migration guide:

> **[Migration to Version 3.0 - laminas-cache - Laminas Docs](https://docs.laminas.dev/laminas-cache/v3/migration/to-version-3/#checklist)**
>
> Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output.

Or release notes:

> **[Release 2.12.0 · laminas/laminas-cache](https://github.com/laminas/laminas-cache/releases/tag/2.12.0)**
>
> Release Notes for 2.12.0
> Feature release (minor)
> This release focuses on providing forward compatibility to the next major release of this component.
> With laminas/laminas-cache v3, using static fac...

> [@tokstar](#):
>
> and don’t know how to add Filesystem Factory since there is no factory file provided.

Have you installed the storage adapter? Since version 3 of laminas-cache all storage adapters are optional, so you can choose for yourself what is really needed for your application. No more installation of adapters you don’t need or blocking because of missing system requirements.

Run installation for laminas-cache-storage-adapter-filesystem:

```bash
composer require laminas/laminas-cache-storage-adapter-filesystem

```

> The biggest change with `laminas-cache` v3.0 is that this component will be shipped without a specific cache adapter. The idea behind this is, that projects can freely choose those cache adapters they really use.

> **[Migration to Version 3.0 - laminas-cache - Laminas Docs](https://docs.laminas.dev/laminas-cache/v3/migration/to-version-3/#migration-to-version-30)**
>
> Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output.

---

<div class="post-metadata">

**Author:** ![tokstar](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@tokstar](https://discourse.laminas.dev/u/tokstar)\
**Post date:** [May 21, 2022, 12:14am UTC](https://discourse.laminas.dev/t/configuration-must-contain-a-adapter-key-in-storageadapterfactory-php/2855/5 "2022-05-21T00:14:59Z")

</div>

> [@froschdesign](#):
>
> Run installation for laminas-cache-storage-adapter-filesystem:

Thank you so much for opening up my eyes!! I haven’t installed laminas-cache-storage-adapter-filesystem, and I did it, it works fine now!! You save my days!!
