Giter Club home page Giter Club logo

featuretogglebundle's Introduction

FeatureToggle Bundle

The bundle provides following features:

  • Toggle upon a feature (on view side, and backend side)
  • Enabling a feature based on probability
  • Request/Session/User based feature enabling

Usage

To add a toggle for the feature:

Step 1

Install the bundle :)

Step 2

Add in configuration file:

  cogi_feature_toggle:
      features:
          feature_we_want_toggle_name:
              likelihood: 50 # in percents, it means likelihood that feature will be enable across request or session (depends on next parameter)
              throughout_session: true # if set to true then once the mechanism enable/disable the feature it's enabled/disabled across entire session
              users: # set users to which the feature will be enabled. For the rest feature will be disabled. Leave this parameter if don't want the feature depend on particular users
                  - 'user1'
                  - 'user2'
          another_feature:
              # ...

Step 3

Toggle a feature from php:

  if ($serviceContainer->get('toggler')->isEnabled('feature_we_want_toggle_name')) {
    // feature based code
  }

Toggle a feature from twig:

  {% if is_feature_enabled('feature_we_want_toggle_name') %}
    {# feature based code #}
  {% endif %}

Tips

  • If you want enable a feature every time it's requested set likelihood to 100
  • If you want disable a feature every time it's requested set likelihood to 0

Known issues

  • Request wide toggling may give different result when there are more than one "isEnabled" method call for one feature across the same request
    • Eg. Likelihood is 50. It may happend than on the backed isEnabled('the_feature') would return true, and the next call false
    • The problem won't happend if "throughout_session" is set to true

featuretogglebundle's People

Contributors

cypisioki avatar

Watchers

Robert Freigang avatar Cyprian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.