exads/ab-test-data

A class that delivers a structured data for A/B Testing

1.0 2022-01-17 12:00 UTC

This package is not auto-updated.

Last update: 2025-03-04 02:28:22 UTC


README

In order to use this library:

  1. Install it using composer:
composer require exads/ab-test-data
  1. Use it in your class:
<?php

namespace MyNamespace;

use Exads\ABTestData;

class MyClass
{
  public function getData(int $promoId): array
  {
    $abTest = new ABTestData($promoId);
    $promotion = $abTest->getPromotionName();
    $designs = $abTest->getAllDesigns();
    // ...
    return array_map(function ($item) {
      // ...
    }, $designs);
  }
}

There are 3 A/B Test promotions that can be accessed via this class. Feel free to use any of them (1, 2, 3).

Designs come in the following format:

$designs = [
  [ 'designId' => 1, 'designName' => 'Design 1', 'splitPercent' => 35 ],
  // [ ... ]
];