定制 graymatterlabs/experiment 二次开发

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

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

graymatterlabs/experiment

最新稳定版本:v0.3

Composer 安装命令:

composer require graymatterlabs/experiment

包简介

README 文档

README

Latest Version on Packagist Tests Total Downloads

This package makes no opinions on how you store your experiment data. Bring your own implementation of GrayMatterLabs\Experiment\Contracts\Persistence or use one of the provided implementations.

How you choose to implement your GrayMatterLabs\Experiment\Contracts\Factory will determine how you reference your experiments throughout the code. By default, there is an implementation provided that references experiments by their fully qualified class names.

Similarly, you may choose to and are encouraged to configure your experiments in a dynamic and/or data-backed way by instantiating them with data from any number of storage mechanisms as well as in any shape you see fit.

In general, this package attempts to not strictly enforce opinions as much as possible but rather provide an open-ended framework for A/B testing that minimizes complexity and overhead. You are encouraged to bring your own concrete implementations of the provided interfaces. You can, however, lean into the implementations provided for you.

Installation

You can install the package via composer:

composer require graymatterlabs/experiment:^0.3

Usage

$manager = new Manager($persistence, $factory, $strategy);
$sample = new Sample();

$allocation = $manager->allocate($experiment, $sample);

if (! $allocation->isAllocated()) {
    // unable to allocate
}

if ($allocation->isVariant('TEST')) {
    // execute experimental feature
}

if ($allocation->wasRecentlyAllocated) {
    // the allocation is new
}

Note: Usage of GrayMatterLabs\Experiment\Persistence\SimpleCachePersistence requires you satisfy the Psr\SimpleCache\CacheInterface interface. See graymatterlabs/simple-cache or bring your own implementation.

Testing

composer test

Changelog

Please see the Release Notes for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-06