AB tests with Symfony 5 made easy

AB tests are not for experimenting things, but to measure them.

Lets run a new AB test with Symfony 5

composer require travaux-com/variantretriever
$affectedVariant = $variantRetriever
->getVariantForExperiment(
new Experiment('my-ab-test'),
(string) $user->getId()
);
$experimentTranslationsKeys = [
'control' => 'email.welcome.subject_control',
'variant' => 'email.welcome.subject_variant',
];
$userVariant = $variantRetriever
->getVariantForExperiment(
new Experiment('my-ab-test'),
(string) $user->getId()
);
$emailSubject = $experimentTranslationsKeys[(string) $userVariant];

Go beyond this example

How does it work internally ?

public function getUserVariantForExperiment(
Experiment $experiment,
User $user
);

--

--

--

Symfony lover, Gopher and opensource enthusiast. Ex-firefighter 🚒, I miss cuting out cars 🚙.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Python program to find the square root of a number using Newton’s method

join discord for free xrp xjumper tokens

Types of API Testing

What Is a Shared Pool In Oracle?

Flutter Apps Development Tutorial : Introducing

Open-Closed principle

🤖💥 @IbgFinance Robo Advisor is launching in Q4 of 2021, simplifying the user experience and…

[LeetCode] (Easy) 58. Length of Last Word

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Thomas P

Thomas P

Symfony lover, Gopher and opensource enthusiast. Ex-firefighter 🚒, I miss cuting out cars 🚙.

More from Medium

How to localize Nette app using contributte/translation and Localazy

Create Unit tests for WordPress Plugin

Running Jetbrains Client with Metal API and ZGC

Convert a local development folder into a Git repository