How to stop Laravel 5 from caching configurations?

前端 未结 3 1031
逝去的感伤
逝去的感伤 2020-12-13 16:52

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 fa

相关标签:
3条回答
  • 2020-12-13 17:33

    As per the post here: https://github.com/laravel/framework/issues/2501

    "Change cache driver to array for the local environment."

    For me this involves adding CACHE_DRIVER=array to my .env file. This is then picked up by my config/cache.php file which includes the line: 'default' => env('CACHE_DRIVER', 'file'),

    Obviously you could change it directly in the config/cache.php but I'd prefer to use the .env file so I can disable it for development sites and enable for production.

    0 讨论(0)
  • 2020-12-13 17:57

    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.

    0 讨论(0)
  • 2020-12-13 17:59

    If you delete this directory [bootstrap/cache] in your project and replace it with a file then it should be impossible for anyone on the team to accidentally cache your config.

    0 讨论(0)
提交回复
热议问题