It is written in Laravel 5 documentation that php artisan config:cache
stores all the app configuration into one single file which makes the application load faster.
I want to know two things:
The first thing is, how to force Laravel to stop caching my app configurations? For example, I want Laravel to read the name of my database and the password from the .env
file or from the database.php
configuration file, not from the cached data.
The second thing is, where does Laravel store this cached configuration file, so that I can delete it when needed? I know there is an Artisan command for that, which is php artisan config:clear
, but I want to know where the file stored.
The cache configuration is located at config/cache. php . In this file you may specify which cache driver you would like used by default throughout your application. Laravel supports popular caching backends like Memcached and Redis out of the box.
To disable the cache you have to add the following to your config/cache. php file. 'stores' => [ //... 'none' => [ 'driver' => 'null', ], ], Now you have to change your CACHE_DRIVER value to none in your .
To clear all Laravel's cache, just run the following command: $ php artisan optimize:clear Compiled views cleared! Application cache cleared!
You can't stop the caching of config files since it doesn't happen automatically. The only thing you need to do, is not call config:cache
.
The file itself can be found in bootstrap/cache/config.php
.
Note that the location of the compiled config file has changed recently. Yours might also be in vendor/config.php
or storage/framework/config.php
. With a fresh install or if you run composer update
the file should be in bootstrap/cache
though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With