定制 researchsquare/exposure 二次开发

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

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

researchsquare/exposure

Composer 安装命令:

composer require researchsquare/exposure

包简介

Selectively expose new features to a subset of your users.

README 文档

README

Research Square's Exposure library provides basic feature flagging capabilities, allowing you to selectively expose new features to a subset of your users. This library was inspired by Etsy's Feature API.

This library is very much in its early stages of development and could change dramatically in the future, though we hope to keep the public API fairly stable.

At present, features can be completely enabled or disabled, enabled for specific users, or enabled for a percentage of users, allowing gradual availability of new features.

Regardless of the method chosen, feature checks are performed with:

if (Exposure\Feature::isEnabled('feature-name')) {
    // feature specific logic.
}

Installation

Install the latest version with:

$ composer require researchsquare/exposure

Integration

To use Exposure in your application, you will need to initialize it with your desired set of features and set the context under which it is operating. How this happens is largely an exercise for you to figure out, but features will typically be defined in your configuration, and Feature and its Context will be initialized during the bootstrapping of your application.

<?php

use Exposure;

// $features is an array of features.
Exposure\Feature::defineFeatures($features);

// $context is an instance of Feature\Context.
Exposure\Feature::setContext($context);

Configuration

An enabled feature

$configuration['feature-name'] = true;

A disabled feature

$configuration['feature-name'] = false;

A feature enabled for specific users

$configuration['feature-name'] = array(
    Exposure\Feature::USER => array(25, 26),
);

A feature enabled for 50% of users

$configuration['feature-name'] = array(
    Exposure\Feature::PERCENTAGE => 50,
);

Rules can be combined, as well.

A feature enabled for specific users or 50% of users

$configuration['feature-name'] = array(
    Exposure\Feature::USER => array(25, 26),
    Exposure\Feature::PERCENTAGE => 50,
);

Establishing context

Feature relies on Context to determine whether a feature is enabled. Context provides information about your application environment, such as the current user. Because establishing context will vary from application to application, it's up to the individual application to define. At present, context provides two pieces of information: the current user's identity and bucketing identity. Bucketing identity is used to identify a user regardless of whether they are anonymous or authenticated, and should remain unchanged throughout that process. This ensures feature availability is consistent for a given user. One method of ensuring this consistency is to store the bucketing identity in a cookie, but, again, this is an exercise left up to the application.

researchsquare/exposure 适用场景与选型建议

researchsquare/exposure 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34.47k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 10 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 researchsquare/exposure 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 researchsquare/exposure 我们能提供哪些服务?
定制开发 / 二次开发

基于 researchsquare/exposure 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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