2017 © Pedro Peláez
 

library php-experiments

PHP Experiments is a library that lets you run A/B and split tests

image

innocraft/php-experiments

PHP Experiments is a library that lets you run A/B and split tests

  • Wednesday, January 10, 2018
  • by innocraft
  • Repository
  • 3 Watchers
  • 10 Stars
  • 5,596 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 45 % Grown

The README.md

PHP Experiments is an A/B Test and Split Test library

Code Status

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version License, (*1)

Introduction

PHP Experiments is built for A/B and Split Testing for Matomo Analytics but can be used in any PHP project. Matomo (formerly Piwik) is the leading open source web analytics platform used on over 1 million websites and apps in over 150 countries. InnoCraft is the company of the makers of Matomo Analytics., (*2)

Features

  • Easily create and run A/B tests and split tests.
  • Experiment traffic allocation: For example configure that only 80% of all users should participate in an experiment.
  • Variation traffic allocation: For example allocate more traffic to some specific variations, giving other variations less traffic.
  • When a user enters an experiment for the first time, a variation will be chosen randomly. On all subsequent requests the same variation will be activated.
  • Possibility to force a specific variation instead of choosing it randomly.
  • To ensure a user always gets to see the same variation, the name of the activated variation is stored in a cookie, a custom storage can be configured.
  • Easy to use with plain arrays and easily extensible and customizable (custom storage, filters and variations can be defined).
  • Tested with unit tests.
  • No dependencies, lightweight, simple.

Example

See examples directory for various examples., (*3)

Running an A/B test might be as easy as:, (*4)

$variations = [['name' => 'green'], ['name' => 'blue']];
$experiment = new Experiment('experimentName', $variations);
$activated = $experiment->getActivatedVariation();

echo $activated->getName();

Running a split URL test can be as easy as:, (*5)

$variations = [
    ['name' => 'layout1', 'url' => '/layout1'], 
    ['name' => 'layout2', 'url' => '/layout2']
];
$experiment = new Experiment('experimentName', $variations);
$activated = $experiment->getActivatedVariation();

// redirects to either URL or does nothing if the original version was activated
$activated->run();

Requirements

  • PHP 5.5.9 or greater

Installation

To get the latest version, require the library using Composer:, (*6)

$ composer require innocraft/php-experiments

Instead, you may manually update your require block and run composer update if you so choose:, (*7)

{
    "require": {
        "innocraft/php-experiments": "^1.0"
    }
}

License

PHP Experiments is released under the LGPL v3 license, see LICENSE., (*8)

Developer

Docs generation

To update the documentation within the docs directory execute the following commands, (*9)

  • cd docs
  • composer install (only needed once)
  • ./generateDocs.sh

The Versions

10/01 2018

dev-master

9999999-dev

PHP Experiments is a library that lets you run A/B and split tests

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.5.9

 

The Development Requires

by InnoCraft Ltd

testing tests experiments split a-b

26/09 2017

1.0.2

1.0.2.0

PHP Experiments is a library that lets you run A/B and split tests

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.5.9

 

The Development Requires

by InnoCraft Ltd

testing tests experiments split a-b

22/12 2016

1.0.1

1.0.1.0

PHP Experiments is a library that lets you run A/B and split tests

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.5.9

 

The Development Requires

by InnoCraft Ltd

testing tests experiments split a-b

20/12 2016

1.0.0

1.0.0.0

PHP Experiments is a library that lets you run A/B and split tests

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.5.9

 

The Development Requires

by InnoCraft Ltd

testing tests experiments split a-b

20/12 2016

dev-302redirect

dev-302redirect

PHP Experiments is a library that lets you run A/B and split tests

  Sources   Download

LGPL-3.0

The Requires

  • php >=5.5.9

 

The Development Requires

by InnoCraft Ltd

testing tests experiments split a-b