ABRouter AB Test 👷♀️ is a simple package for base library to run A/B tests via ABRouter with Symfony. You can find base PHP library in https://github.com/abrouter/abrouter-php-client
You're welcome to visit the docs.
ABRouter is the service to manage experiments(A/B split tests). The service provides easy to manage dashboard to keep experiments under control. There you can create experiments, branches and set a percentage for every branch. Then, when you're running an ab-test on PHP you will receive a perfect branch-wise response that following the rules, that you set up.
Can be also used as a feature flag or feature toggle. Available for free.
Besides of the installing this package you need to have an account on ABRouter. Your token and experiment id will be also there.
Via composer
$ composer require abrouter/symfony-abtest
Register bundle
// config/bundles.php
return [
// [...]
Abrouter\SymfonyClient\AbrouterClientBundle::class => ['all' => true],
];
Put your ABRouter token in /config/packages/abrouter_client.yaml. You can find this token in ABRouter dashboard.
abrouter_client:
token: 'YOUR_TOKEN'
host: 'https://abrouter.com'
use Abrouter\Client\Client;
class ExampleController
{
public function __invoke(Client $client)
{
$buttonColorExperimentId = 'D1D06000-0000-0000-00005030';
return new Response(json_encode([
'button_color' => $client
->experiments()
->run('USER_ID', $buttonColorExperimentId),
]));
}
}
You can create an experiment and get your token and id of experiment on ABRouter or just read the docs.
You can get an dockerized usage example by the following link: (https://github.com/abrouter/symfony-abtest-example)
Please feel free to fork and sending Pull Requests. This project follows Semantic Versioning 2 and PSR-2.
GPL3. Please see License File for more information.