Skip to content

Instantly share code, notes, and snippets.

@yatsenkolesh
Last active June 23, 2022 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yatsenkolesh/a30a5e1b5608ac3de4902fdc6b83353a to your computer and use it in GitHub Desktop.
Save yatsenkolesh/a30a5e1b5608ac3de4902fdc6b83353a to your computer and use it in GitHub Desktop.
<?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