An artisan command for managing multiple .env
of your Laravel 5 app.
- Copy
EnvCommand.php
toapp/Console/Commands/
of your Laravel 5 app. - Register the command in
app/Console/Kernel.php
(or copy the one from this repo)
Save the current .env
into .$APP_ENV.env
.
$ php artisan env
Current application environment: local
$ php artisan env:switch --save
Environmental config file .local.env saved
Switch to another environment, given .$TARGET_ENV.env
exists.
$ php artisan env
Current application environment: test
$ php artisan env:switch local
Successfully switched from test to local.
$ php artisan env
Current application environment: local
- Thanks @leonel for raising the issue, which inspired me to create this command.