项目作者: rapidwebltd

项目描述 :
🆎 PHP Bucket Testing, A/B testing, split testing
高级语言: PHP
项目地址: git://github.com/rapidwebltd/php-bucket-testing.git
创建时间: 2017-03-21T10:25:49Z
项目社区:https://github.com/rapidwebltd/php-bucket-testing

开源协议:GNU Lesser General Public License v3.0

下载


PHP Bucket Testing

Build Status
Coverage Status
StyleCI

This library enables developers to easily redirect users to different URLs, for the purpose
of bucket testing. Bucket testing is also known as A/B testing or split testing.

This type of testing is used to test two or more versions of a webpage to determine which one
performs better based on specfied key metrics, such as clicks, downloads, purchases or any other
form of conversion.

Features

  • Random selection of buckets, with optional weights
  • Automatic handling of temporary redirects
  • Ability to retrieve bucket and manually handle URL redirection
  • Easy to use fluent interface syntax

Installation

To install, just run the following composer command.

composer require rapidwebltd/php-bucket-testing

Remember to include the vendor/autoload.php file if your framework does not already do so.

Usage

  1. use \RapidWeb\BucketTesting\BucketManager;
  2. use \RapidWeb\BucketTesting\Bucket;
  3. // Create a new bucket manager
  4. $bucketManager = new BucketManager;
  5. // Add buckets, with URLs and optional weights
  6. $bucketManager->add(new Bucket('https://google.co.uk/'))->withWeight(25);
  7. $bucketManager->add(new Bucket('https://php.net/'))->withWeight(75);
  8. // Redirect to a randomly selected URL
  9. $bucketManager->redirect();
  10. // Or, if you wish, get a random bucket and manually handle the redirection
  11. $bucket = $bucketManager->getRandomBucket();
  12. header('location: '.$bucket->url);