bestit/feature-toggle-bundle

此包已被废弃且不再维护。作者建议使用 flagception/flagception-bundle 包代替。

功能开关包增强版。

安装次数: 13,485

依赖项: 0

建议者: 0

安全: 0

星标: 179

关注者: 8

分支: 26

开放问题: 9

类型:symfony-bundle

4.3.0 2022-04-22 13:52 UTC

README

功能开关包增强版! Flagception 是一个简单而强大的 PHP 功能开关系统。此包集成了 Flagception PHP 库,用于 symfony 2.7 到 5.*(以及 php 5.6 到 php7.*)。

Latest Stable Version Coverage Status Build Status Total Downloads License

SensioLabsInsight

包版本(标签) 支持 Symfony 分支
<=3 2.7 - 4.4 3.x
>=4 4.4 - 当前 master
$ composer require flagception/flagception-bundle

文档

快速示例

在您的配置中设置一些功能(或使用您自己的 激活器 从您想要的任何地方获取功能)...

flagception:

    # Your Features (optional you left it empty)
    features:
    
        # Feature name as key
        feature_123:
            # Default flag if inactive or active (default: false)
            default: true
            
        # Feature state from an environment variable
        feature_abc:
            env: FEATURE_ENV_ABC
            
        # Feature with constraint (active if user id is 12 OR it is between 8 am and 6 pm)
        feature_def:
            constraint: 'user_id == 12 or (date("H") > 8 and date("H") < 18)'
                    
        # All togther (chain)
        feature_def:
            default: false
            env: FEATURE_ENV_ABC
            constraint: 'user_id == 12 or (date("H") > 8 and date("H") < 18)'

...然后在控制器、服务或 Twig 中使用它

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

请参阅 使用文档 获取详细示例。

分析器

此包提供了一个分析器标签页,您可以在其中查看功能被请求的频率,它返回的结果(活动或非活动)以及给定的上下文。

Image of Profiler

鸣谢

分析器图标来自 https://github.com/ionic-team/ionicons