2017 © Pedro Peláez
 

project knobby

Manage knobs and levers for feature control

image

deseretdigital/knobby

Manage knobs and levers for feature control

  • Wednesday, January 25, 2017
  • by JustinCarmony
  • Repository
  • 2 Watchers
  • 6 Stars
  • 10,368 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 3 Versions
  • 4 % Grown

The README.md

Build Status, (*1)

knobby

Provides SDK for using feature flags., (*2)

Flag Types

Levers

A flag that passes its test if it's turned on., (*3)

include('./vendor/autoload.php');

$config = array(
    array(
        'name' => 'exampleOn',
        'on' => true,
        'type' => 'lever',
    ),
    array(
        'name' => 'exampleOff',
        'on' => false,
        'type' => 'lever',
    ),
);

$knobby = new \DDM\Knobby\Knobby();
$knobby->loadConfigArray($config);

if ($knobby->test('exampleOn')) {
    /*
    feature code here will run as the lever is on
    */
}

if ($knobby->test('exampleOff')) {
    /*
    feature code here will not run as the lever is off
    */
}

Knobs

A flag that passes its test if a test value is below the knob's value., (*4)

include('./vendor/autoload.php');

$config = array(
    array(
        'name' => 'testKnob',
        'type' => 'knob',
        'value' => 15,
    ),
);

$knobby = new \DDM\Knobby\Knobby($config);

$userValue = 20;
if ($knobby->test('testKnob', $userValue)) {
    /*
    feature code here will not run, since the
    user value is greater than the allowed value
    */
}

Knobs can also be used to randomly generate a test value within a specified range and then test this random value against the knob's value., (*5)

include('./vendor/autoload.php');

$config = array(
    array(
        'name' => 'testKnob',
        'type' => 'knob',
        'min' => '10',
        'max' => '50',
        'value' => 15,
    ),
);

$knobby = new \DDM\Knobby\Knobby($config);

if ($knobby->test('testKnob')) {
    /*
    feature code here may or may not run depending on the value of the randomly
    generated test value between 10 and 50.
    */
}

The Versions

25/01 2017

dev-master

9999999-dev

Manage knobs and levers for feature control

  Sources   Download

MIT

The Development Requires

13/03 2015
13/03 2014

v0.1

0.1.0.0

Manage knobs and levers for feature control

  Sources   Download

MIT

The Development Requires