Skip to content
This repository has been archived by the owner on Nov 23, 2019. It is now read-only.
/ flipper Public archive

[WIP] Simple and extensible feature flipper for php

Notifications You must be signed in to change notification settings

coduo/flipper

Repository files navigation

flipper

Build Status Scrutinizer Code Quality

WIP Simple and extensive feature flipper for php. Identifier centric.

Create a context and register your arguments in context

<?php
use Coduo\Flipper;
use Coduo\Flipper\Feature\Repository\InMemoryFeatureRepository;
use Coduo\Flipper\Activation\Strategy;

$context = new Flipper\Activation\Context('default');
$context2 = new Flipper\Activation\Context('some_dummy_context');
$context->registerArgument(new Flipper\Activation\Argument\UserIdentifier('[email protected]');
```php

## Set up your feature definitions

$flipper = new Flipper(new InMemoryFeatureRepository());
$flipper->addContext($this->context);

$feature = new Feature('captcha', new Strategy\UserIdentifier(
    new Flipper\Activation\Argument\UserIdentifier('[email protected]')
]));

$feature2 = new Feature('new_topbar', new Strategy\SystemWide(true));
$flipper->add($feature);
$flipper->add($feature2);

Check it

<?php
$flipper->isActive('captcha', 'default'); #true
$flipper->isActive('captcha', 'Argument'); #false
require: {
   "coduo/flipper": "dev-master"
}

About

[WIP] Simple and extensible feature flipper for php

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published