PHP code example of abrouter / symfony-abtest

1. Go to this page and download the library: Download abrouter/symfony-abtest library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abrouter / symfony-abtest example snippets


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),
        ]));
    }
}

// config/bundles.php
return [
    // [...]
    Abrouter\SymfonyClient\AbrouterClientBundle::class => ['all' => true],
];