2dotstwice/silex-feature-toggles-provider 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

2dotstwice/silex-feature-toggles-provider

Composer 安装命令:

composer require 2dotstwice/silex-feature-toggles-provider

包简介

Feature toggles for Silex

README 文档

README

Build Status

Installation

Service provider

Register the FeatureTogglesProvider with your Silex application. $featureToggleConfiguration should be an array with the toggle configuration. You can for example retrieve this from a configuration file, but how to handle that is up to your application.

$app->register(
    new \TwoDotsTwice\SilexFeatureToggles\FeatureTogglesProvider(
        $featureToggleConfiguration
    )
);

At 2dotstwice, we've been successfully using this together with DerAlex's YamlConfigServiceProvider.

$app->register(new \DerAlex\Silex\YamlConfigServiceProvider(__DIR__ . '/config.yml'));

$app->register(
    new \TwoDotsTwice\SilexFeatureToggles\FeatureTogglesProvider(
        $app['config']['toggles']
    )
);

The contents of config.yml might look like this:

toggles:
  profile-date-of-birth:
    name: profile-date-of-birth
    conditions: {}
    status: always-active
  remember-password-option:
    name: remember-password-option
    conditions: {}
    status: inactive

For details on the configuration semantics, consult the documentation of Qandidate's Toggle library.

Tiny REST API

Additionally, you can add a small REST API which exposes the state of the toggles by mounting the FeatureTogglesControllerProvider in your Silex application. This might be useful for manual inspection, or when the state of the toggles is needed on a decoupled front-end.

$app->mount('/', new \TwoDotsTwice\SilexFeatureToggles\FeatureTogglesControllerProvider());

A request to /toggles will return a JSON response. An example of a response body:

{
    "profile-date-of-birth": true,
    "remember-password-option": false
}

true means the toggle is currently ON, false means it is OFF.

统计信息

  • 总下载量: 12.93k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-12