pheature / inmemory-toggle
Pheature 标志内存切换实现库。
0.8.0
2023-12-03 12:49 UTC
Requires
- php: ~8.0.0|~8.1.0|~8.2.0|~8.3.0
- pheature/toggle-core: ^0.8
- pheature/toggle-model: ^0.8
- webmozart/assert: ^1.10
Requires (Dev)
- icanhazstring/composer-unused: ^0.8.5
- phpcompatibility/php-compatibility: ^9.3
- phpro/grumphp: ^1.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.0
- phpstan/phpstan-webmozart-assert: ^1.0
- phpunit/phpunit: ^8.0 || ^9.0
- roave/infection-static-analysis-plugin: ^1.18
- squizlabs/php_codesniffer: ^3.4
- symfony/var-dumper: ^4.2 || ^5.0 || ^6.0
- vimeo/psalm: ^4.4|^5.16
README
安装
使用composer包管理器进行安装。
composer require pheature/inmemory-toggle
用法
查看更多示例,请访问https://github.com/pheature-flags/pheature-flags/tree/1.0.x/examples。
<?php declare(strict_types=1); use Pheature\Core\Toggle\Read\Toggle; use Pheature\InMemory\Toggle\InMemoryConfig; use Pheature\InMemory\Toggle\InMemoryFeatureFactory; use Pheature\InMemory\Toggle\InMemoryFeatureFinder; require '../vendor/autoload.php'; $config = [ 'toggles' => [ 'feature_1' => [ 'id' => 'feature_1', 'enabled' => false, 'strategies' => [] ], ] ]; $toggle = new Toggle(new InMemoryFeatureFinder( new InMemoryConfig($config['toggles']), new InMemoryFeatureFactory() )); if ($toggle->isEnabled('feature_1')) { echo 'The feature_1 is work in progress.' . PHP_EOL; } if (false === $toggle->isEnabled('feature_1')) { echo 'The old functionality to be changed when the feature_1 is ready.' . PHP_EOL; }
贡献
欢迎您的贡献!请首先查看贡献指南。
许可证
我们非常相信开源软件,我们围绕它构建了我们的职业生涯,我们觉得我们需要将我们的知识回馈给社区。因此,我们将在BSD-3-Clause许可证下发布所有我们的包。