abrouter/abrouter-laravel-bridge

AbrLaravelClient :construction_worker_woman: is a PHP client for laravel to run ab-tests via ABRouter.

0.11.0 2022-04-19 11:44 UTC

This package is auto-updated.

Last update: 2022-05-09 17:39:03 UTC


README

ABRouter AB Test 👷‍♀️ is a simple package for base library to run A/B tests via ABRouter (open-source) with Laravel. You can find base PHP library in https://github.com/abrouter/abrouter-php-client

What is the ABRouter service ?

ABRouter is the open-source product to manage experiments(A/B split tests). The service provides easy to manage dashboard to keep experiments under control. You can create experiments, branches and set up a percentage for every branch. Then, when you're running an ab-test on PHP you will receive a perfect branch-wise response that following the rules, that you set up.

Can be also used as a feature flag or feature toggle. Available for free.

You can find the ABRouter product source code by the following link: https://github.com/abrouter/compose

Features

🛠 A/B Tests

🛠 Feature flags

🛠 Built-in statistics

🛠 Incredible UI to manage it

Prepare your first A/B test

Besides of the installing this package you need to have an account on ABRouter. Your token and experiment id will be also there. Feel free to read step by step instruction Impelementing A/B tests on Laravel

📦 Install

Via composer

$ composer require abrouter/laravel-abtest

Setting service provider

This package provide auto discovery for service provider

If Laravel package auto-discovery is disabled, add service providers manually to /config/app.php. There are service provider you must add:

\Abrouter\LaravelClient\Providers\AbrouterServiceProvider::class

Publish client configuration:

php artisan vendor:publish --tag=abrouter

Configure ABRouter client:

Put your ABRouter token in /config/abrouter.php. You can find this token in ABRouter dashboard.

return [
    'token' => '14da89de1713a74c1ed50aafaff18c24bf372a9913e67e6a7a915def3332a97c9c9ecbe2cd6d3047',
    'host' => 'https://abrouter.com',
];

🚀 Usage

use Abrouter\Client\Client;

class ExampleController
{
    public function __invoke(Client $client)
    {
        $buttonColor = $client->experiments()->run(uniqid(), 'D1D06000-0000-0000-00005030');
        return view('button', [
            'color' => $buttonColor->getBranchId(),
        ]);
    }
}

You can create an experiment and get your token and id of experiment on ABRouter or just read the docs.

Example

You can get an dockerized usage example by the following link: (https://github.com/abrouter/laravel-example)

🔧 Contributing

Please feel free to fork and sending Pull Requests. This project follows Semantic Versioning 2 and PSR-2.

📄 License

GPL3. Please see License File for more information.