Hello,
i was reading Laravel - Code Smart 2016 by Dayle Rees when i come across with this statement:
"If you wanted to, you could certainly stick to env(), however, this way(referring to use env() over config() to access environment variables) you won’t be able to make use of the caching functionality of Laravel’s configuration layer. You see, Laravel can cache your configuration files to make the framework more performant. However, it can’t cache values from environmental variables, so if you choose to use env() outside of the PHP configuration files then you might end up getting yourself in a caching mess. We don’t want that, do we?"
So, is this true? because everywhere i see there are people accessing env variables with env() from all kind of places (controllers, views, etc).
Is it better to create a file in config/, access env from there and then use config() to access cached env variables?
Are only the variables in config/ files cached?