humweb/features

Feature toggle package

dev-master / 1.0.x-dev 2015-07-17 02:57 UTC

This package is auto-updated.

Last update: 2024-10-29 03:39:39 UTC


README

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight Total Downloads Latest Version on Packagist Software License

Feature Toggle allows developers to toggle on/off features in the system using one or multiple Strategies.

Install

Via Composer

$ composer require humweb/features

Usage

DateTime Strategy

$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

$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

$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 for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email ryun@humboldtweb.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.