A Laravel package to easily manage and switch between multiple environment files using artisan cli.
composer require neelkanthk/laravel-easyenv
php artisan vendor:publish --provider="Neelkanth\Laravel\EasyEnv\Providers\EasyEnvServiceProvider" --tag="config"
Add the following lines just before the php return $app;
in the bootstrap/app.php
use Neelkanth\Laravel\EasyEnv\EasyEnv;
$app->useEnvironmentPath(EasyEnv::path())->loadEnvironmentFrom(EasyEnv::file());
The package provides following artisan
commands to add/remove and enable/disable environments.
The commands have following signature.
php artisan easyenv:[action] {env} {path} {file}
[action] : Following action are available list|add|remove|enable|disable
{env}: The name of your choice for the environment.
{path}: The absolute path of the location of the environment file
{file}: The name of the environment file residing on the filesystem.
php artisan easyenv:add staging /var/www/env/ .staging
Only 1 environment can be enabled at a time.
php artisan easyenv:enable staging
php artisan easyenv:list
Environment | Status | Path | File |
---|---|---|---|
staging | Enabled | /var/www/env/ | .staging |
php artisan easyenv:disable
php artisan easyenv:remove staging
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
If you discover any security-related issues, please email me.neelkanth@gmail.com instead of using the issue tracker.