https://github.com/humweb/features
Feature Toggle/Flag component
https://github.com/humweb/features
Last synced: 6 months ago
JSON representation
Feature Toggle/Flag component
- Host: GitHub
- URL: https://github.com/humweb/features
- Owner: humweb
- License: mit
- Created: 2015-06-24T07:28:52.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-17T02:57:49.000Z (almost 11 years ago)
- Last Synced: 2024-05-01T11:02:29.438Z (about 2 years ago)
- Language: PHP
- Homepage: http://humboldtweb.com
- Size: 207 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Features Toggle
[](https://travis-ci.org/humweb/features)
[](https://scrutinizer-ci.com/g/humweb/features/?branch=master)
[](https://scrutinizer-ci.com/g/humweb/features/?branch=master)
[](https://insight.sensiolabs.com/projects/726e2642-6553-40e1-8b4f-71f8d905d7f9)
[](https://packagist.org/packages/humweb/features)
[](https://packagist.org/packages/humweb/features)
[](LICENSE.md)
Feature Toggle allows developers to toggle on/off features in the system using one or multiple Strategies.
## Install
Via Composer
``` bash
$ composer require humweb/features
```
## Usage
#### DateTime Strategy
``` php
$features = new Features();
$features->create('test.feature', 'Example feature description')
->add('StrategyKeyString', 'DataTime', [
'date' => '2015-11-10',
'operator' => '>'
])
->setThreshold(1);
if ($features->isEnabled('test.feature')) {
// Do something special
}
```
#### DateTimeRange Strategy
``` php
$features = new Features();
$features->create('test.feature', 'Example feature description')
->add('StrategyKeyString', 'DataTimeRange', [
'start' =>'2100-11-10',
'end' => '2100-12-10',
'strict' => false
])
->setThreshold(1);
if ($features->isEnabled('test.feature')) {
// Do something special
}
```
#### DaysOfWeek mixed with DateTimeRange Strategy
``` php
$features = new Features();
$features->create('business.hours', 'Match days of week')
->add('DaysOpen', 'DaysOfWeek', [
'days' => ['sat']
])
->add('StoreHours', 'DateTimeRange', [
'start' =>'9am',
'end' => '11pm',
'strict' => true
])
->setThreshold(2);
if ($features->isEnabled('business.hours')) {
// Do something special
}
```
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email ryun@humboldtweb.com instead of using the issue tracker.
## Credits
- [Ryan Shofner (Maintainer)](https://github.com/ryun)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.