neelkanthk / laravel-easyenv
使用命令行轻松管理和切换多个环境文件。
1.1.0
2020-10-04 13:19 UTC
Requires
- php: >=7.2
- laravel/framework: >=6.0
This package is auto-updated.
Last update: 2024-08-29 05:33:58 UTC
README
EasyEnv
一个Laravel包,用于通过Artisan命令行工具轻松管理和切换多个环境文件。
安装
composer require neelkanthk/laravel-easyenv
发布配置文件。
php artisan vendor:publish --provider="Neelkanth\Laravel\EasyEnv\Providers\EasyEnvServiceProvider" --tag="config"
使用
在bootstrap/app.php文件中在php return $app; 之前添加以下行
use Neelkanth\Laravel\EasyEnv\EasyEnv; $app->useEnvironmentPath(EasyEnv::path())->loadEnvironmentFrom(EasyEnv::file());
通过CLI管理环境
该包提供了以下artisan命令来添加/移除和启用/禁用环境。
命令的签名如下。
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.
1. 添加新环境。
php artisan easyenv:add staging /var/www/env/ .staging
2. 启用环境。
一次只能启用一个环境。
php artisan easyenv:enable staging
3. 列出所有可用环境。
php artisan easyenv:list
4. 禁用当前启用环境。
php artisan easyenv:disable
5. 移除环境
php artisan easyenv:remove staging
贡献
欢迎提交Pull requests。对于重大更改,请先提交一个issue以讨论您想要进行的更改。
安全
如果您发现任何与安全相关的问题,请发送电子邮件到me.neelkanth@gmail.com,而不是使用问题跟踪器。
