Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Spillmester's avatar

Caching routes/env/config in Lumen

How do I enable caching in Lumen 8

Docs says it works like in Laravel but there is no php artisan optimize or php artisan config:cache

Does it just work?

Tried setting environment to production, but nothing ends up in storage/framework/cache/data

I have facades enabled. Not changed/made an config/cache.php so default should be file system for caching

0 likes
3 replies
rodrigo.pedra's avatar

The optimize command in Laravel just runs config:cache and route:cache. When the cached files exist Laravel use them instead of loading up config and routes. By the way in a Laravel app the cached config and routes lives in the ./bootstrap/cache directory.

Lumen does not even look for cached config or routes files, as you can see here:

Neither Lumen has a ./bootstrap/cache directory.

1 like
Spillmester's avatar

Thank you for your reply

Had a hard time wrapping my head around why Lume does not have config:cache & route:cache. I take the answer is because t does not need it. Would only save a few includes for config. Not really looked deep into Lumen routes but got the understanding performing well.

Its a small project I converted from laravel, mainly just because I wanted to try/learn Lumen.

I just dont see any significant performance difference. Perhaps Laravel is to fast :)

Looking into opcache on the production machine.

Cant complain to much about 60-70ms for transfer start time in postman. And pretty much same for my most costly(still cheap) and json "hello world". Trying Cloudways(on digital ocean) so locked to apache. Handshake takes 30-40ms. Throws me of to see the 100ms

Please or to participate in this conversation.