2017 © Pedro Peláez
 

library feature

Feature API used for operational Dark Launching ad A/B Testing.

image

eleme/feature

Feature API used for operational Dark Launching ad A/B Testing.

  • Friday, May 16, 2014
  • by thbourlove
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2,799 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Feature

Build Status Coverage Status Scrutinizer Code Quality SensioLabsInsight Stable Status, (*1)

Feature API used for operational Dark Launching ad A/B Testing., (*2)

Install With Composer:

"require": {
    "eleme/feature": "~0.1"
}

Features Example:

<?php

use Feature\Features;

require_once(__DIR__.'/../vendor/autoload.php');

$user = array(
    'name' => 'a',
    'admin' => false,
);
$config = array(
    'featureA' => true,
    'featureB' => function () use ($user) {
        return $user['admin'];
    },
    'featureC' => function () use ($user) {
        return $user['name'] == 'a' ? 'foo' : 'bar';
    },
    'featureD' => 'd',
);
$features = new Features($config);
echo var_export($features->variant('featureA')), "\n"; // true
echo var_export($features->variant('featureB')), "\n"; // false
echo var_export($features->variant('featureC')), "\n"; // 'foo'
echo var_export($features->variant('featureD')), "\n"; // 'd'
echo var_export($features->variant('featureZ')), "\n"; // false

Service Provider With Silex:

<?php

use Silex\Application;
use Feature\Provider\Silex\FeaturesServiceProvider;

require_once(__DIR__.'/../vendor/autoload.php');

$app = new Application();

$app->register(new FeaturesServiceProvider);

$app['features.config'] = array(
    'featureA' => true,
);

echo var_export($app['features']->variant('featureA')), "\n"; // true

Twig Extension:

in php:
<?php

use Feature\Features;
use Feature\Provider\Twig\Feature;

require_once(__DIR__.'/../vendor/autoload.php');

$options = getopt('u:');
$user = isset($options['u']) && $options['u'] === 'admin' ? 'admin' : 'user';

$config = array(
    'foo' => true,
    'bar' => function () use ($user) {
        return $user === 'admin' ? 'admin' : 'user';
    },
);
$features = new Features($config);

$loader = new Twig_Loader_Filesystem(__DIR__.'/templates');
$twig = new Twig_Environment($loader);
$twig->addExtension(new Feature($features));
echo $twig->render('foo.twig');
in twig:
{% feature foo %}
foo ok
{% endfeature %}
{% feature bar - admin %}
bar admin
{% endfeature %}
{% feature bar - user %}
bar user
{% endfeature %}

The Versions

16/05 2014

dev-master

9999999-dev

Feature API used for operational Dark Launching ad A/B Testing.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Hongbo Tang

17/04 2014

v0.1.1

0.1.1.0

Feature API used for operational Dark Launching ad A/B Testing.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Hongbo Tang

15/04 2014

v0.1.0

0.1.0.0

Feature API used for operational Dark Launching ad A/B Testing.

  Sources   Download

MIT

The Development Requires

by Hongbo Tang