PHP code example of ben182 / laravel-ab

1. Go to this page and download the library: Download ben182/laravel-ab 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/ */

    

ben182 / laravel-ab example snippets


AbTesting::pageView()

// get the underlying model
AbTesting::getExperiment()

// get the experiment name
AbTesting::getExperiment()->name

// get the visitor count
AbTesting::getExperiment()->visitors

public function index(Request $request) {
    // the same as 'AbTesting::getExperiment()'
    $request->abExperiment()
}

AbTesting::completeGoal('signup')

AbTesting::getCompletedGoals()
bash
php artisan vendor:publish --provider="Ben182\AbTesting\AbTestingServiceProvider"
bash
php artisan migrate
bash
php artisan ab:report
bash
php artisan ab:reset