nvanheuverzwijn / php-config-yaml
0.0.1
2017-06-19 04:20 UTC
Requires
- php: >=5.6.0
- nvanheuverzwijn/php-config: >=0.0.1
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2024-02-04 00:15:59 UTC
README
yaml配置解析器。这是更大配置库的一部分,可以在此处找到。
使用方法
此yaml读取器接受一个配置数组作为参数。它支持两个键:file用于指定要读取的yml文件,以及yaml_parser用于指定一个解析yaml的调用函数。
直接以此方式使用此读取器。
$reader = new Yaml\Reader([
'file' => '/some/file.yml',
'yaml_parser' => '\Symfony\Component\Yaml\Yaml::parse'
]);
$array = $reader->fetchAll();
使用此读取器与\Zwijn\Config。
$conf = \Zwijn\Config\ConfigFactory::fromArray([
'reader' => [
[
'class' => '\Zwijn\Config\Yaml\Reader'
'config' => [
'file' => '/some/file.yml',
'yaml_parser' => '\Symfony\Component\Yaml\Yaml::parse'
]
]
]
]);
依赖
make composer
测试
make test