What is difference between use env(‘APP_ENV’), config(‘app.env’) or App::environment() to get app environment?
In Short & up-to-date 2022: use env() only in config files use App::environment() for checking the environment (APP_ENV in .env). use config(‘app.var’) for all other env variables, ex: config(‘app.debug’) create own config files for your own ENV variables. Example: In your .env: MY_VALUE=foo example config/myconfig.php return [ ‘myvalue’ => env(‘MY_VALUE’, ‘bar’), // ‘bar’ is default … Read more