Difference between "php artisan config:cache" and "php artisan cache:clear" in Laravel

Viewed 35741

In Laravel have noticed there is two way to clear the cache

php artisan cache:clear

and

php artisan config:cache

However i realized only the second one working properly when changing the localization, adding laravel/passport package and etc..

What is their difference ?

2 Answers

php artisan cache:clear - Flush the application cache

php artisan config:cache - Create a cache file for faster configuration loading. This is for configuration cache. This command will clear the configuration cache before it creates. More details

php artisan config:clear - Remove the configuration cache file

BTW there are also

php artisan route:cache

and

php artisan route:clear

commands available which create and clear route cache respectively. And many others similar commands I found in the Laravel Artisan Cache Commands Explained article.

Related