Level 1
Instead of calling config() at file load time, put them inside a function so they’re only called after the app has booted:
// app/helpers.php
if (!function_exists('myAppName')) {
function myAppName()
{
return config('app.name'); // works fine at runtime
}
}
This way config('...') runs only when you call myAppName(), not when Composer autoloads the file.