This library should be use in each project you need detect the environment.
composer.json
{
"require": {
"powerlinks/environment": "dev-master"
}
}
It can be used two type of environment definition:
- file
- global variable
By default the file name, where the environment name is stored, is ".env.php" in the project directory. The file ".env.php" has to added to .gitignore to avoid to push in production the wrong environment definition.
This solution is very fast and it allows you to force the environment during the server set up and you will not have to take care of it anymore. A global variable have to be defined at http server level and it can be configured for either apache or nginx.
This solution is very fast and it allows you to force the environment during the server set up and you will not have to take care of it anymore. A global variable have to be defined at http server level and it can be configured for either apache or nginx.
SetEnv ENVIRONMENT development
location / {
...
fastcgi_param ENVIRONMENT development;
...
}