项目作者: bestit

项目描述 :
Feature flags on steroids!
高级语言: PHP
项目地址: git://github.com/bestit/flagception-bundle.git
创建时间: 2017-07-06T18:15:29Z
项目社区:https://github.com/bestit/flagception-bundle

开源协议:MIT License

下载


Flagception

Feature toggle bundle on steroids! Flagception is a simple and powerful feature toggle system for php.
This bundle integrates the Flagception PHP Libary for symfony 2.7 to 5. (and php 5.6 to php7.).

Latest Stable Version
Coverage Status
Build Status
Total Downloads
License

SensioLabsInsight

Bundle Version (Tag) Support Symfony Branch
<=3 2.7 - 4.4 3.x
>=4 4.4 - current master
  1. $ composer require flagception/flagception-bundle

Documentation

Quick example

Set some feature in your config (or use your own activator for fetching features from wherever you want) …

  1. flagception:
  2. # Your Features (optional you left it empty)
  3. features:
  4. # Feature name as key
  5. feature_123:
  6. # Default flag if inactive or active (default: false)
  7. default: true
  8. # Feature state from an environment variable
  9. feature_abc:
  10. env: FEATURE_ENV_ABC
  11. # Feature with constraint (active if user id is 12 OR it is between 8 am and 6 pm)
  12. feature_def:
  13. constraint: 'user_id == 12 or (date("H") > 8 and date("H") < 18)'
  14. # All togther (chain)
  15. feature_def:
  16. default: false
  17. env: FEATURE_ENV_ABC
  18. constraint: 'user_id == 12 or (date("H") > 8 and date("H") < 18)'

… and use it in controller, services or twig:

  1. {% if feature('feature_123') %}
  2. {# Execute if feature is active ... #}
  3. {% endif %}

See usage documentation for detailed examples.

Profiler

This bundle ships a profiler tab, where you can see how often a feature was requested, which results it returns (active or inactive) and
the given context.

Image of Profiler

Credits

Profiler icon from https://github.com/ionic-team/ionicons