PHPackages                             bentools/split-test-analyzer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bentools/split-test-analyzer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bentools/split-test-analyzer
============================

Bayesian probability calculator for split testing / AB testing.

1.1(8y ago)921.6k↑20.8%2MITPHPPHP &gt;=7.1

Since Aug 28Pushed 8y ago4 watchersCompare

[ Source](https://github.com/bpolaszek/split-test-analyzer)[ Packagist](https://packagist.org/packages/bentools/split-test-analyzer)[ RSS](/packages/bentools-split-test-analyzer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/93b54ff7e5d9d53af1f05e70441515058fdb43857312dde424494fca365583ce/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f73706c69742d746573742d616e616c797a65722f762f737461626c65)](https://packagist.org/packages/bentools/split-test-analyzer)[![License](https://camo.githubusercontent.com/10885e4178ee6055dd63e52817ae62b74ea02aa4fe35794d2b0506d3612e3e4d/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f73706c69742d746573742d616e616c797a65722f6c6963656e7365)](https://packagist.org/packages/bentools/split-test-analyzer)[![Build Status](https://camo.githubusercontent.com/81464254687bb43aea1962cbb553a4977be2b7fdb9dfb435f4a46c67b12287bb/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f62706f6c61737a656b2f73706c69742d746573742d616e616c797a65722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/bpolaszek/split-test-analyzer)[![Coverage Status](https://camo.githubusercontent.com/5fc9d1e8e55cc095997a941f01942319a6e1216b470d605edd1ac49408163ab5/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f62706f6c61737a656b2f7069636b65722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/bpolaszek/picker?branch=master)[![Quality Score](https://camo.githubusercontent.com/2da2d36a436cb1bfdc73738bee2ca96395e60d4a5795a8fe41c3dadb5fc78f2e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f62706f6c61737a656b2f73706c69742d746573742d616e616c797a65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bpolaszek/split-test-analyzer)[![Total Downloads](https://camo.githubusercontent.com/7df22b06cbeed0afad0a75a9b9134d3fc8aa8d65c3f7c1ab40f54f072fbbc4b4/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f73706c69742d746573742d616e616c797a65722f646f776e6c6f616473)](https://packagist.org/packages/bentools/split-test-analyzer)

Split Test Analyzer
===================

[](#split-test-analyzer)

This PHP tool will help you compute, for different versions of a split test, their probability to be the best one.

It is a PHP port of the JS tool used on [AB split test graphical Bayesian calculator](https://www.peakconversion.com/2012/02/ab-split-test-graphical-calculator/).

Concept
-------

[](#concept)

A `Variation` object is composed of 3 informations:

- A `key` to identify it (the Landing page / banner id for instance)
- The total number of actions (let's say, the unique visitors)
- The number of successful actions (let's say, the conversions)

Now you can compare those 3 objects and compute their probability to be the best.

Usage
-----

[](#usage)

```
use BenTools\SplitTestAnalyzer\SplitTestAnalyzer;
use BenTools\SplitTestAnalyzer\Variation;

require_once __DIR__ . '/vendor/autoload.php';

$variations = [
    new Variation('LP #1', 8686347, 932),
    new Variation('LP #2', 7305026, 804),
    new Variation('LP #3', 4592639, 371),
    new Variation('LP #4', 4590186, 402),
    new Variation('LP #5', 4532325, 470),
    new Variation('LP #6', 4531653, 494),
];

$predictor = SplitTestAnalyzer::create()->withVariations(...$variations);
foreach ($predictor->getResult() as $key => $value) {
    printf('%s has %d%% chances to be the best one.' . PHP_EOL, $key, $value);
}

print PHP_EOL;

printf('The best one is: %s', $predictor->getBestVariation());
```

Output:

```
LP #1 has 15% chances to be the best one.
LP #2 has 43% chances to be the best one.
LP #3 has 0% chances to be the best one.
LP #4 has 0% chances to be the best one.
LP #5 has 7% chances to be the best one.
LP #6 has 34% chances to be the best one.

The best one is: LP #2
```

Because of the randomness used in Bayes calculator, results may slightly vary.

To improve performance you can lower the amount of samples with `SplitTestAnalyzer::create(100)`, but then you'll have to choose between performance and reliability.

Installation
------------

[](#installation)

This library requires PHP 7.0+.

> composer require bentools/split-test-analyzer

Tests
-----

[](#tests)

> ./vendor/bin/phpunit

See also
--------

[](#see-also)

[bentools/cartesian-product](https://github.com/bpolaszek/cartesian-product)

[bentools/pager](https://github.com/bpolaszek/bentools-pager)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~47 days

Total

3

Last Release

3090d ago

PHP version history (2 changes)1.0PHP &gt;=7.0

1.1PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/acdd1a8ee0e657ddd06cf11f98a32100ef7121afb8aa270a5b295f5c29c038b3?d=identicon)[bpolaszek](/maintainers/bpolaszek)

---

Top Contributors

[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (4 commits)")

---

Tags

bayesbayesiansplit testinganalyzerab testab-testingsplit testbayesian probabilitybayesian probabilities

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bentools-split-test-analyzer/health.svg)

```
[![Health](https://phpackages.com/badges/bentools-split-test-analyzer/health.svg)](https://phpackages.com/packages/bentools-split-test-analyzer)
```

###  Alternatives

[camspiers/statistical-classifier

A PHP implementation of Complement Naive Bayes and SVM statistical classifiers, including a structure for building other classifier, multiple data sources and multiple caching backends

17237.0k1](/packages/camspiers-statistical-classifier)[fieg/bayes

Implementation of Naive Bayes Classifier algorithm in PHP.

7394.1k](/packages/fieg-bayes)[niiknow/bayes

a machine learning lib

6950.0k](/packages/niiknow-bayes)[madeitbelgium/seo-analyzer

SEO Analyzer

334.8k1](/packages/madeitbelgium-seo-analyzer)[ajgarlag/feature-flag-bundle

Provides a feature flag mechanism

1417.8k](/packages/ajgarlag-feature-flag-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
