Configuration

Statamic uses standard Laravel config files and environment variables for application-level settings.

Config Files

Statamic's config files are located in config/statamic/. They are PHP files named by area of responsibility.

config/statamic/
amp.php
api.php
assets.php
cp.php
forms.php
live_preview.php
oauth.php
protect.php
revisions.php
routes.php
search.php
sites.php
stache.php
static_caching.php
system.php
theming.php
users.php

Environment Variables

It is often helpful to have different configuration setting based on the environment where the site is running. For example, you may wish to enable debug mode on your local server but not your production server

Warning!

Never enable Debug Mode or DebugBar on production. The error messages — as beautiful as they are — will reveal much about the way your site is configured, where important files are, and possibly even leak data from your .env file depending on how you use those variables.

In a fresh Statamic installation you'll find an .env.example file in the root directory of your site. Rename or copy it to .env to enable it. If you install Statamic via Composer or the CLI tool, this will be done automatically for you.

Environment Variable Types

Variables in your .env files are parsed as strings. In order to handle a wider range of types, some specific values are reserved.

.env   Value Parsed Value
true (bool) true
(true) (bool) true
false (bool) false
(false) (bool) false
empty (string) ''
(empty) (string) ''
null (null) null
(null) (null) null

If you need to define an environment variable with a value containing a space, you may do so by enclosing the value in double quotes.

APP_NAME="Gluten Free Potato Canons"

Retrieving Environment Variables

All environment variables are available in your config files by using the env() helper function. An optional second argument allows you to pass a default value.

// config/app.php
'awesome' => env('ENABLE_AWESOME', true),

Once passed into a config file, the variable can be used in your views with the {{ config }} tag.

// To retrieve the above 'awesome' value...
{{ config:app:awesome }}

Once passed into a config file, the variable can be used in your views with the config() helper function.

// To retrieve the above 'awesome' value...
{{ config('app.awesome') }}
Warning!

Your .env file should never be committed to version control.

Each developer or server running your application may require a different configuration, not to mention it can be a security risk in the event your version control repository is ever made public. Any sensitive credentials — like API keys and secret tokens — would be visible.

Hiding Environment Variables from Debug Pages

When an exception is uncaught and the APP_DEBUG environment variable is true, the debug page will show all environment variables and their contents. You may obscure variables by updating the debug_blacklist option in your config/app.php config file.

return [
 
// ...
 
'debug_blacklist' => [
'_ENV' => [
'APP_KEY',
'MAILCHIMP_API_KEY',
'BITCOIN_WALLET_PW',
],
 
'_SERVER' => [
'APP_KEY',
'DB_PASSWORD',
],
 
'_POST' => [
'password',
],
],
];

Learn more about environment configuration in the Laravel docs.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →