pheature / inmemory-toggle
Pheature flags In Memory toggle implementation library.
Fund package maintenance!
pheature-flags
Installs: 51 712
Dependents: 4
Suggesters: 3
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
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
Installation
Install it using composer package manager.
composer require pheature/inmemory-toggle
Usage
Check https://github.com/pheature-flags/pheature-flags/tree/1.0.x/examples for more 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; }
Contributing
Your contributions are always welcome! Please have a look at the contribution guidelines first.
License
We really believe in the Open Source Software, we built our carers around it, and we feel that we need to return our knowledge to the community. For this reason we release all our packages under BSD-3-Clause licence.