定制 npg/bandiera-client-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

npg/bandiera-client-php

最新稳定版本:1.0.1

Composer 安装命令:

composer require npg/bandiera-client-php

包简介

Bandiera is a simple, stand-alone feature flagging service that is not tied to any existing web framework or language. This is a client for talking to the web service.

README 文档

README

This is a client for talking to the Bandiera feature flagging service from a PHP application.

This client is compatible with the v2 Bandiera API.

Build status MIT licensed

Installation

Installation is done via composer. In your composer.json file add:

{
    "require": {
        "npg/bandiera-client-php": "~1.0"
    }
}

Usage

You can interact with the Bandiera server like so:

<?php

include 'vendor/autoload.php';

$bandiera = new Nature\Bandiera\Client('http://bandiera-demo.herokuapp.com');

if ($bandiera->isEnabled('my_app', 'super_new_feature')) {
    // show the super new feature!
}

The Nature\Bandiera\Client::isEnabled command takes two main arguments - the 'feature group', and the 'feature name'. This is because in Bandiera, features are organised into groups as it is intented as a service for multiple applications to use at the same time - this organisation allows separation of feature flags that are intended for different audiences.

Nature\Bandiera\Client::isEnabled also takes an optional params array, this is for use with some of the more advanced features in Bandiera - user group and percentage based flags. It is in this params array you pass in your user_group and user_id, i.e.:

$bandiera->isEnabled('my_app', 'super_new_feature', [
    'user_id' => 1234567,
    'user_group' => 'Administrators'
]);

For more information on these advanced features, please see the Bandiera wiki:

https://github.com/springernature/bandiera/wiki/How-Feature-Flags-Work#feature-flags-in-bandiera

Direct API Access

If you'd prefer not to use the isEnabled method for featching feature flag values, the following methods are available...

Get features for all groups:

Nature\Bandiera\Client::getAll($params = []);

Get features for a group:

Nature\Bandiera\Client::getFeaturesForGroup($group, $params = []);

Get an individual feature:

Nature\Bandiera\Client::getFeature($group, $feature, $params = []);

Development

  1. Fork this repo.
  2. Run composer install

License

© 2014 Springer Nature. Bandiera PHP Client is licensed under the MIT License.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 344
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-07