Download the PHP package lwc/kumite without Composer
On this page you can find all versions of the php package lwc/kumite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package kumite
Short Description A simple library for multivariate testing in web applications
License MIT
Informations about the package kumite
Table of contents
- What is kumite?
- Installing
- Running tests
- Starting tests
- Varying content
- Tracking events
- Defining tests
- Integrating with your application
- Configuring
- StorageAdapter
- CookieAdapter
- Contributing
What is kumite?
Kumite is a framework for managing split testing.
It's purpose is to manage and track participants in split tests, as well as track events/outcomes. It makes no assumptions about how participants are allocated into variants.
Tests may be defined with a number of variants and an allocation strategy that can assign a variant to a request. Events may be tracked against variants, with optional metadata if desired. It makes no assumptions about how your application interacts with cookies or how you would like to store test data. It is named for the fictional fighting tournament, portrayed in the 1988 Jean-Claude Van Damme movie Bloodsport.
Installing
The easiest way to install is via composer: composer require lwc/kumite
Running tests
- Starting tests
- Varying content
- Tracking events
Starting tests
In order to run a test, you must first select a starting point for your test. Typically this will happen inside a controller action in your application. When starting a test, you must provide the test key of the defined test and optionally an array of metadata to attach to the test participant and allocation method that will override the method declared in the test definition. Allocators must be an instance that implements Allocator, something callable in php terms, or a constant value representing a variant.
Using a constant value:
Using the Allocator interface:
Using a callback:
Varying content
There are two main ways to vary content to participants in a test, via the variant key and via variant properties:
Requests that are not participating in the test will be allocated to the defined default variant for purposes of varying content, but no events will be tracked against them.
Tracking events
Tracking events in kumite is achieved by calling Kumite::event($testKey, $eventKey, $metadata=array())
:
Defining tests
Tests are defined in the following format:
Integrating with your application
- Configuring
- StorageAdapter
- CookieAdapter
Configuring
During the initialisation of your application, you need to configure kumite.
StorageAdapter
So that kumite can save participant and event data, you need to define a StorageAdapter.
Luckily, this is rather trivial, eg:
CookieAdapter
If your application has a specific mechanism for interacting with cookies, you will need to define a CookieAdapter so that kumite may tag requests with variant tokens.
For example, here is the source of the included default PhpCookieAdapter
:
Contributing
If you've found a bug or would like to contribute, please create an issue here on GitHub, or better yet fork the project and submit a pull request!