config()
Twig Function
You may access configuration values using the config()
helper function. It returns the current value from the configuration store.
The following example will output the value currently stored in app.locale
.
{{ config('app.locale') }}
The above is the PHP equivalent of the following:
<?= Config::get('app.locale') ?>
# env()
As companion function called env()
can be used to access environment variables.
The following example would output the value currently stored in APP_ENV
environment variable. Second argument is default value, when ENV key does not exists.
{{ env('APP_ENV', 'production') }}
The above is the PHP equivalent of the following:
<?= env('APP_ENV', 'production') ?>
The config()
and env()
functions are not available when safe mode is enabled.