Last active
June 23, 2022 23:43
-
-
Save yatsenkolesh/a30a5e1b5608ac3de4902fdc6b83353a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controller; | |
use Abrouter\Client\Client; | |
use Abrouter\Client\Manager\ExperimentManager; | |
use Symfony\Component\HttpFoundation\Response; | |
class IndexController | |
{ | |
public function index(Client $client) | |
{ | |
$userId = $this->getUser()->getUsername(); | |
/** | |
* The button color will be changed 50% green/50% red | |
*/ | |
$buttonColorExperimentId = 'button_color_test'; | |
return new Response(json_encode([ | |
'button_color' => $client | |
->experiments() | |
->run($userId, $buttonColorExperimentId)->getBranchId(), | |
])); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment