Detect usage of env()
function outside from config folder
#1695
Labels
enhancement
New feature or request
env()
function outside from config folder
#1695
Hello,
In order to be able to use the
config:cache
command, we need to ensure that our project only use theenv()
function inside config files.See related laravel documentation: https://laravel.com/docs/10.x/configuration#configuration-caching
Unfortunately, it seems that many developers are not aware about this and I can find usage of
env()
function in most of the projects I joined in the last few years.I am looking for a solution to detect usage of
env()
outside of config files and make our CI to fail if that happens, so we can safely use theconfig:cache
command during deployments.I did not find any rule to detect that in Larastan and I was thinking that it could be a good feature to add.
The text was updated successfully, but these errors were encountered: