PHP code example of exads / ab-test-data
1. Go to this page and download the library: Download exads/ab-test-data library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
exads / ab-test-data example snippets
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);
}
}
$designs = [
[ 'designId' => 1, 'designName' => 'Design 1', 'splitPercent' => 35 ],
// [ ... ]
];