轨道器 / 卫星配置
具有缓存的简单配置聚合器。
0.2.1
2022-10-20 18:20 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ^9.5
README
- 简单配置聚合器带缓存
查看 satellite-app 以获取可用的模板,或者仅安装此库
composer require orbiter/satellite-config
- ConfigProvider 实现
Satellite\Config\ConfigProviderInterface
- ConfigInvokableProvider 使用
__invoke(): array
$aggregator = new \Satellite\Config\ConfigAggregator($is_prod ? __DIR__ . '/tmp/config_aggregated.php' : null); $aggregator->append( ConfigProvider::class, ConfigInvokableProvider::class, // pass down functions which return an array (when using cache: only executed on warm-up) static fn() => [ 'some_array' => [ 'a' => [], ], ], // pass down arrays: [ 'some_array' => [ 'b' => [], // functions can also be used nested (when using cache: only executed on warm-up) 'c' => static fn() => [], ] ], ); // just aggregate: $config = $aggregator->make(); // aggregate and use cache (if configured): $config = $aggregator->configure();
开发提示
设置和运行命令,例如测试
# on windows: docker run -it --rm -v %cd%:/app composer install docker run -it --rm -v %cd%:/var/www/html php:8.1-cli-alpine sh docker run --rm -v %cd%:/var/www/html php:8.1-cli-alpine sh -c "cd /var/www/html && ./vendor/bin/phpunit --testdox -c phpunit-ci.xml --bootstrap vendor/autoload.php" # on unix: docker run -it --rm -v `pwd`:/app composer install docker run -it --rm -v `pwd`:/var/www/html php:8.1-cli-alpine sh docker run --rm -v `pwd`:/var/www/html php:8.1-cli-alpine sh -c "cd /var/www/html && ./vendor/bin/phpunit --testdox -c phpunit-ci.xml --bootstrap vendor/autoload.php"
版本
本项目遵循 semver,直到 1.0.0
,从 0.1.0
开始:所有 0.x.0
版本类似于主版本,所有 0.0.x
类似于次版本或补丁版本,小于 0.1.0
的模块应被视为实验性的。
许可证
本项目是自由软件,根据 MIT 许可证 进行分发。
贡献者
通过将您的代码提交到代码仓库,您同意在存储库附加的 MIT 许可证下发布代码。
由 Michael Becker 维护