gap / config
此包的最新版本(v2.0.2)没有提供许可证信息。
Gap Config
v2.0.2
2018-02-28 08:32 UTC
Requires
- php: >=7.1.0
README
<?php use Gap\Config\ConfigBuilder; $settingDir = '/your/setting/dir'; $cacheFile = '/your/setting/cache-file'; $configBuilder = new ConfigBuilder( $settingDir, $cacheFile ); $config = $configBuilder->build(); $debug = $config->bool('debug'); // false $dbDefaultConfg = $config->config('db')->config('default'); $dbDefaultConfig->str('driver'); $dbDefaultConfig->str('database'); $dbDefaultConfig->str('host'); $dbDefaultConfig->str('username'); $dbDefaultConfig->arr('username'); /* [ 'driver' => 'mysql', 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'database' => 'db', 'host' => 'host', 'username' => 'username', 'password' => 'passwd' ] */
设置目录结构
- setting/
- system/ 系统配置
- custom/ 自定义配置,可以覆盖系统配置
- local/ 本地配置,可以覆盖自定义和系统配置,被git忽略
- setting.app.php
- setting.local.php
配置加载顺序
- setting.local.php(必需)
- setting.app.php(必需)
- system/
- custom/
- local/