An artisan command for using multiple environment configurations in Laravel 5
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app/Console
README.md

README.md

Laravel 5 env

An artisan command for managing multiple .env of your Laravel 5 app.

Installation

  1. Copy EnvCommand.php to app/Console/Commands/ of your Laravel 5 app.
  2. Register the command in app/Console/Kernel.php (or copy the one from this repo)

Usage

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

Thank you

  • Thanks @leonel for raising the issue, which inspired me to create this command.