zrcing / phpenv
轻松从 $_ENV, $_SERVER, getenv 加载系统环境配置。
v1.0.0
2016-09-13 02:40 UTC
Requires
- php: >=5.3
This package is not auto-updated.
Last update: 2024-09-14 18:31:33 UTC
README
轻松从 $_ENV, $_SERVER, getenv 加载系统环境配置。##安装 使用以下命令安装最新版本:
$ composer require zrcing/phpenv
或
{
"name" : "project name",
"repositories" : [ {
"type" : "composer",
"url" : "https://packagist.org.cn/"
}],
"require": {
"zrcing/phpenv": "~1.0"
}
}
##演示 ###步骤 1: 创建 .env 文件
#Master database
DB_HOST = '127.0.0.1' #Local database
DB_NAME="db_name"
DB_USER="root"
DB_PWD="root"
DB_PORT=3306
#Slave database 1
DB_SLAVE1_HOST="127.0.0.1"
DB_SLAVE1_NAME="db_name"
DB_SLAVE1_USER="root"
DB_SLAVE1_PWD="root"
DB_SLAVE1_PORT=3306
###步骤 2: 使用 Phpenv\Env;
$envFile = realpath(".env");
Env::load($envFile);
print_r($_ENV);
print_r($_SERVER);
许可证
在 MIT 许可证 下发布。