simplydi / simplyconfig
为使用yaml文件的任何应用程序提供一个非常简单的配置组件
dev-main
2023-08-05 07:25 UTC
Requires
- symfony/yaml: ^6.3
This package is auto-updated.
Last update: 2024-09-05 09:49:28 UTC
README
使用Yaml文件验证简单配置组件
用法
您的YAML文件:settings.yaml
app: name: It works timezone: UTC otherConfig: this thing works too
在您的应用程序中:
// init the class and pass the path to yaml file $config = new \SimplyDi\SimplyConfig\Config("/path/to/settings.yaml"); // can use dot notation $appName = $config->get('app.name'); echo $appName; // prints "It works" echo $config->get('otherConfig'); // prints "this thing works too"