Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel routing cache

When I develop a Laravel application I used to clear cache after making any changes to routes\web.php or routes\api.php. Recently I was working on a project for a fellow and found out that the project does not need clearing cache every time I make a change in any of the files I have mentioned.

So I want to know what is the problem with the autoloader or what exactly is the general problem?

like image 947
Abdullah Muhammed Avatar asked Nov 02 '25 06:11

Abdullah Muhammed


1 Answers

When you use commands like

php artisan optimize

php artisan route:cache

your route files(under routes/) are being parsed and cached. Now, next requests will be routed from cached routes, not from routes/*.php.

If you have used above commands, after making changes to route php files, you should re-cache them, or use

php artisan route:clear

to remove the cache. Then, next requests will be routed by routes/*php files.

like image 134
Davud Safarov Avatar answered Nov 04 '25 20:11

Davud Safarov