Laravel Configuration Cheatsheet

You may access configuration values using the Global config helper function from anywhere in the application.

$value = config('app.timezone');

To set the config values at runtime, pass an array to the config helper

config(['app.timezone' => 'America/Chicago']);  

The current application environment is determined via the APP_ENV variable from your .env file. You may access this value via the environment method on the App facade:

$environment = App::environment();

You may also pass arguments to the environment method to check if the environment matches a given value. If necessary, you may even pass multiple values to the environment method. If the environment matches any of the given values, the method will return true:

if (App::environment('local')) {  
    // The environment is local

if (App::environment('local', 'staging')) {  
    // The environment is either local OR staging...

An application instance may also be accessed via the app helper method:

$environment = app()->environment();