PHP code example of filipe07 / laravel-ab

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

    

filipe07 / laravel-ab example snippets


AbTesting::pageView()

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

// get the variant name
AbTesting::getVariant()->name

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

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

AbTesting::completeGoal('signup')

AbTesting::getCompletedGoals()

AbTesting::pageview($identifier)

AbTesting::completeGoal('payment-completed', $identifier)
bash
php artisan vendor:publish --provider="AbTesting\AbTestingServiceProvider"
bash
php artisan migrate
bash
php artisan ab:report
bash
php artisan ab:reset