How to implement A/B | split tests with Symfony?

The ABRouter is an open-source, developer-oriented tool for implementing managed A/B tests with high-level Symfony support.
The service providing a clear web interface to manage experiments, powerful API to run and track results of the tests in your Symfony application.
Installing via composer package for Symfony.
Takes minutes to start your first A/B test. Additionally, we have the packages for vanilla PHP and Laravel:

PHP guide
Laravel guide

Start for free

Image

Why do we need A/B tests?

Long story short - to improve conversions. The main advantage of AB-testing is making the right decisions.

Real world example: you have a two implementations of free trials on your website. In the first case, you require a card number to sign up, and for the second your user can proceed to the platform without the card. What is the best choice in that case?

AB test with two branches can show you the right answer. Your decision will be based on the number of completed sign-ups and the final number of the paid users in these branches.

Start for free
Image

Our first task with A/B test

Task definition
Our task is testing the most convertible color of form button. For example, your current color of sign up button is blue, but you want to check, what if the green button will be more convertible?
Goal:
to test most convertible color of form button
Branches:
red - 33%, green - 33%, blue - 33%.
Technically:
assign the color of the button: which the user got into.

Creating first A/B test on ABR side

So, there are the step to be done:
Step 1: Sign-up by the link
Step 2: Create your experiment
Pay attention to the Experiment ID. You will use it as the identifier of experiment to run it.
Step 3: Grab the data
After creating the A/B test you can to get the important data to run it.
Experiment id:

Token:

Application side | Start coding

Step 1: Install
Install the library to your codebase on PHP: https://github.com/abrouter/symfony-abtest
This library based on main ABRouter client: https://github.com/abrouter/abrouter-php-client
1
Install the package:
composer require abrouter/symfony-abtest
2
Register the bundle:
// config/bundles.php
return [
// [...]
Abrouter\SymfonyClient\AbrouterClientBundle::class => ['all' => true],
];
3
Configure the client:
Put your ABRouter token in /config/packages/abrouter_client.yaml
abrouter_client:
  token:                ''
  host:                 'https://abrouter.com'

This file on GitHub
Step 2: Code
Now we are ready to code. Also, you can check an example of fully completed code on GitHub:
https://github.com/abrouter/symfony-abtest
Step 3: There is our result
Color of the button will be automatically changed on each request for every page reload. Because we have used uniqid(). ABRouter system will memorize the relation between user identifier and branch he got, so if we will repeat the request with the same user identifier we will get the same branch as on previous run.

Getting started is easy

Find key retention drivers with ABRouter
Create your first A/B test

Summary

I have shown you how to implement an A/B test with Symfony framework via ABRouter. Looks like it's quite simple.
Please, remember, that every change that you are making to the app should be through an A/B test. It's a key to build a successful product.

If you have any questions, feel free to ask me at abrouter@proxiedmail.com

Image
Alex Yatsenko Senior Developer at ABRouter