The directory for the configuration files is:
A typical application begins with three environments: dev, prod and test. Each environment represents a way to execute the same codebase with different configuration. Each environment loads its own individual configuration files.
These different files are organized by environment:
- for the
- for the
- for the (phpunit)
config/settings.php is the main configuration file and combines the default settings with environment specific settings.
The configuration files are loaded in this order:
Load default settings from:
If the environment variable
APP_ENVis defined, load the environment specific file, e.g.
Load secret credentials (if file exists) from:
To switch the environment you can change the
APP_ENV environment variable.
$_ENV['APP_ENV'] = 'prod';
For security reasons, all secret values are stored in a file called:
Create a copy of the file
config/env.example.php and rename it to
env.php file is generally kept out of version control since it can contain sensitive API keys and passwords.
- Environments and Configuration (Slim 4 - eBook Vol. 1)