bangpound/composer-dotenv
Composer 安装命令:
composer require bangpound/composer-dotenv
包简介
Load environment variables from `.env` when Composer runs
README 文档
README
Whenever Composer is activated in a project with a .env file, this plugin will use the
vlucas/phpdotenv library to load this configuration
file into the PHP envrionment.
This plugin works well with incenteev/composer-parameter-handler
which allows you to map environment variables to parameters. This plugin runs when composer
is activated, and ParameterHandler finds that configuration in the environment after your dependencies
have been installed or updated.
Example
If your .env file contains:
SECRET_FOR_ME="123456"
And your composer.json file contains:
{
"require": {
"incenteev/composer-parameter-handler": "~2.0",
"bangpound/composer-dotenv": "~1.0@dev"
},
"extra": {
"incenteev-parameters": {
"file": "app/config/parameters.yml",
"env-map": {
"secret": "SECRET_FOR_ME"
}
}
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
]
},
}
Then after running composer update or install, your app/config/parameters.yml
will contain:
# This file is auto-generated during the composer install parameters: secret: 123456
Settings
In the extra property of the root repository, change these values as necessary:
{
"extra": {
"dotenv": {
"path": ".",
"file": ".env"
}
}
}
统计信息
- 总下载量: 30.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-12-03