wtframework/config
最新稳定版本:v0.1.0
Composer 安装命令:
composer require wtframework/config
包简介
What the Framework?! config
README 文档
README
Installation
composer require wtframework/config
Documentation
Use the set static method to set the configuration settings.
If you pass an array as the first parameter then this will replace all existing settings.
use WTFramework\Config\Config; Config::set(['key1' => 'value1']);
If you pass a string as the first parameter and any value as the second parameter then this will add the setting to the existing settings.
Config::set('key2', 'value2');
Dot notation can be used to set a nested value.
Config::set(['key1' => ['key2' => 'value2']]); Config::set('key1.key3', 'value3');
Use the get static method to return a configuration setting.
If the setting does not exist then it will return null or the value passed as the second parameter.
Config::set(['key1' => 'value']); // Returns 'value' $key1 = Config::get('key1'); // Returns null $key2 = Config::get('key2'); // Returns 0 $key3 = Config::get('key3', 0);
Dot notation can be used to return a nested value.
Config::set(['key1' => ['key2' => 'value']]); // Returns 'value' $key2 = Config::get('key1.key2');
A config function is also provided as a wrapper around Config::get:
use function WTFramework\Config\config; $key = config('key', 'default');
统计信息
- 总下载量: 416
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-26