ikovbas / laravel-env-switcher
Laravel 5 / Lumen 5 环境切换器
v1.1.1
2015-08-01 11:36 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-28 17:43:53 UTC
README
环境切换器帮助您管理Laravel 5 / Lumen 5应用程序的多个.env文件。
dotenv的问题在于您不能将所有环境下的.env文件放在版本控制下。本包旨在帮助您解决这个问题。更多详情请见使用部分。
安装
环境切换器可以通过Composer全局安装或按项目安装
-
全局:
composer global require ikovbas/laravel-env-switcher
-
按项目:
composer require ikovbas/laravel-env-switcher
Laravel集成
打开您的Laravel配置文件config/app.php
,并将本包的服务提供者添加到$providers
数组中
'IKovbas\EnvSwitcher\EnvSwitcherServiceProvider'
Lumen集成
打开您的bootstrap/app.php
文件,并将以下行添加到注册服务提供者
部分
$app->register('IKovbas\EnvSwitcher\EnvSwitcherServiceProvider');
使用
-
显示当前环境
$ php artisan env:switch Current application environment: production
-
将当前
.env
文件保存为.env.$APP_ENV
$ php artisan env:switch --save Environmental config was successfully saved to .env.production
-
切换到另一个环境
$ php artisan env:switch development Successfully switched from production to development
注意:在调用命令之前,应该存在
.env.development
文件。
版权和许可
The MIT License
Copyright (c) 2015 Ivan Kovbas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.