Laravel0Laravel A/B Testing and Feature Flag Package

[ad_1]

The Laravel A/B Test package helps you quickly set up A/B tests and feature flags in a Laravel app. The package uses the self-hosted ABRouter service (which also has paid hosted options) to power the A/B and feature flag settings.

Here’s an example controller using this package to A/B test UI features, in this case, a button color:

1use Abrouter\Client\Client;

2 

3class ExampleController

4{

5 public function __invoke(Client $client)

6 {

7 $userId = auth()->user()->id;

8 $buttonColor = $client->experiments()->run($userId, 'button_color');

9 return view('button', [

10 'color' => $buttonColor->getBranchId(),

11 ]);

12 }

13}

Another useful feature is feature flags, which help you roll experimental/new features out to customers incrementally, toggling on/off without a code redeploy:

1$isEnabledButton = $client->featureFlags()

2 ->run('enabled_button_feature_flag');

3 

4view('featureFlags', [

5 'enabledButtonFeatureFlag' => $isEnabledButton,

6]);

You’ll need to set up the ABRouter service to use this package. You can learn more about this service from the ABRouter Docs. You can learn about this package, get full installation instructions, and view the source code on GitHub.

[ad_2]

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *