承接 mordilion/split-test 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mordilion/split-test

最新稳定版本:v0.3.2.3

Composer 安装命令:

composer require mordilion/split-test

包简介

A library to get the ability of split testing (A/B testing)

README 文档

README

It's a small library to get the ability of adding your own split testing (A/B testing) logic to your project.

Simple usage

<?php use Mordilion\SplitTest\Container; use Mordilion\SplitTest\Model\Experiment; // receive seed cookie if available $seed = $_COOKIE['seed'] ?? time(); $experimentName = 'an-experiment'; // set up the container with tests $container = new Container(); $experiment = new Experiment($experimentName, true); $experiment->addVariation(new Experiment\Variation('a', 50)); // 50% $experiment->addVariation(new Experiment\Variation('b', 50)); // 50% $container->addExperiment($experiment); // select the variation based on the provided seed $variation = $container->getExperimentVariation($experimentName); if ($variation === null) { // happens only, if the experiment wasn't defined throw new \RuntimeException(sprintf('Experiment "%s" does not exist!', $experimentName)); } if ($variation->getName() === 'b') { echo 'Variation B'; } else { echo 'Variation A'; } // set seed cookie for next visit setcookie('seed', $seed, time() + (3600 * 24 * 30)); // 30 days valid - after 30 days the user is unknown!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固