-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Closed
Labels
Description
- Laravel Version: 5.8.15
- PHP Version: 7.3.4
Description:
The documentation says that "The current application environment is determined via the APP_ENV variable from your .env file.". It also says that "The current application environment detection can be overridden by a server-level APP_ENV environment variable."
However, when using artisan with the --env option, App::environment() will return the value of the --env option. To me as a developer, I find it logical that the --env option is used to determine the .env file to use, not to overrule the environment. After all, the name of the .env file can differ from the APP_ENV value in that file.
Steps To Reproduce:
- Copy the
.envfile to.env.foo; - Change the value of
APP_ENVwithin.env.footobar; - Run
php artisan tinker; - Execute the command
App::environment(), the value ofAPP_ENVshould be returned; - Quit Tinker and run
php artisan tinker --env=foo; - Execute the command
App::environment(); foois now returned, instead ofbar.
khflab and xk4r00t