alex014 / confy
Confy配置工具
1.1
2020-08-02 19:54 UTC
Requires
- php: >=7.0
This package is auto-updated.
Last update: 2024-09-29 05:36:26 UTC
README
安装和用法
composer require alex014/confy
<?php
use \Confy\Confy;
Confy::load('config/database.ini');
echo Confy::get('login');
print_r(Confy::getAll());
方法
Confy::load(string $filename)加载配置文件(支持ini, json, php, yaml格式),可加载多个配置文件Confy::get(string $name)获取配置值Confy::has(string $name)检查配置键是否存在Confy::set(string $name, $value)设置配置值Confy::unset(string $name)删除配置值Confy::getAll()
插件
- 所有插件位于
/src/Parser目录。 - 所有插件必须按照大写文件扩展名命名(Ini.php -> .ini)。
- 所有插件类必须实现
\Confy\Interfaces\Parser接口
运行测试
- 安装PHPUnit
wget -O phpunit https://phar.phpunit.de/phpunit-9.phar并chmod +x phpunit - 运行测试
./phpunit ConfyTest.php
许可证
MIT许可证