轨道器/卫星配置

具有缓存的简单配置聚合器。

0.2.1 2022-10-20 18:20 UTC

This package is auto-updated.

Last update: 2024-09-20 22:58:33 UTC


README

Latest Stable Version Latest Unstable Version codecov Total Downloads Github actions Build PHP Version Require

  • 简单配置聚合器带缓存

查看 satellite-app 以获取可用的模板,或者仅安装此库

composer require orbiter/satellite-config
$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 维护