OneBite.Dev - Coding blog in a bite size

How to optimize laravel app with caching config, route and view

How to optimize laravel app with caching route and config. All it's done by simple one-line command

You’ve deployed your big laravel app and now it’s ready to be used by hundreds if not thousands of people.

We don’t want every time a user access our app, it re-read the config or the route part, since it’s not changing that much.

Let’s cache it!

php artisan config:cache
php artisan route:cache
php artisan view:cache

Refresh Cache

What if you change any configuration and route, suddenly you don’t see any new changes in your laravel app. Don’t worry, we just need to clear and recache everything

//clear it first  
php artisan config:clear
php artisan route:clear
php artisan view:clear

//recache everything  
php artisan config:cache
php artisan route:cache
php artisan view:cache
laravel