All Projects → tabuna → experiment

tabuna / experiment

Licence: MIT license
A/B cookie testing tool for @laravel

Programming Languages

PHP
23972 projects - #3 most used programming language
Blade
752 projects

Projects that are alternatives of or similar to experiment

evolutio
ab testing framework with automated code removing
Stars: ✭ 15 (-72.73%)
Mutual labels:  ab-testing, abtesting, abtest
growthbook
Open Source Feature Flagging and A/B Testing Platform
Stars: ✭ 2,342 (+4158.18%)
Mutual labels:  ab-testing, abtesting, abtest
Wysiwyg.ABTesting
A/B Testing Package for Neos
Stars: ✭ 16 (-70.91%)
Mutual labels:  ab-testing, abtesting
abba
A/B Testing framework
Stars: ✭ 16 (-70.91%)
Mutual labels:  ab-testing
laravel-monitoring
Monitor your Laravel servers
Stars: ✭ 118 (+114.55%)
Mutual labels:  laravel-framework
Employee
A Simple Employee Management System with Materializecss and Laravel
Stars: ✭ 82 (+49.09%)
Mutual labels:  laravel-framework
koselig
💌 Seamlessly integrate Wordpress with Laravel.
Stars: ✭ 65 (+18.18%)
Mutual labels:  laravel-framework
Eloquent-ORM-Laravel-8.5-Relationships-Advanced
Software of Application with Laravel and MySQL
Stars: ✭ 14 (-74.55%)
Mutual labels:  laravel-framework
php-client
PHP SDK client for Split Software
Stars: ✭ 14 (-74.55%)
Mutual labels:  ab-testing
laravel-lumen-docker
Laravel/Lumen Docker Scaffold
Stars: ✭ 72 (+30.91%)
Mutual labels:  laravel-framework
laravel-ab
Laravel A/B experiment testing tool
Stars: ✭ 108 (+96.36%)
Mutual labels:  ab-testing
LaravelTube
Open source project about sharing videos platform built on Laravel
Stars: ✭ 22 (-60%)
Mutual labels:  laravel-framework
finance
💰 Free open-source personal finance tracking web application.
Stars: ✭ 156 (+183.64%)
Mutual labels:  laravel-framework
laravel-smart-facades
Strategy design pattern in laravel, the easiest way.
Stars: ✭ 84 (+52.73%)
Mutual labels:  laravel-framework
laravel-admin
Laravel Admin panel with theme , modules ,artisan commands and helper classess.Laravel admin boilerplate with theme and modules
Stars: ✭ 22 (-60%)
Mutual labels:  laravel-framework
Human-Resources-Management-System
Human Resources Management System Project
Stars: ✭ 32 (-41.82%)
Mutual labels:  laravel-framework
iter8
Kubernetes release optimizer
Stars: ✭ 217 (+294.55%)
Mutual labels:  ab-testing
Laravel-Trik-Indonesia
Kumpulan trik laravel berbahasa indonesia
Stars: ✭ 74 (+34.55%)
Mutual labels:  laravel-framework
knight
Nginx Http 集群api 统计监控、灰度发布、频率控制
Stars: ✭ 68 (+23.64%)
Mutual labels:  abtest
VariantRetriever
VariantRetriever is a minimalist package for feature flagging
Stars: ✭ 23 (-58.18%)
Mutual labels:  ab-testing

Experiment

tests

An A/B Testing suite for Laravel, which allows multiple experiments.

Installation

Download using Composer:

$ composer require orchid/experiment

Base Usage

Your cache driver will be used by default.

use Orchid\Experiment\Experiment;

$experiment = new Experiment();

// Distribution
$ab = $experiment->start([
    'A' => 1,
    'B' => 1,
]); // A or B

The experiment is transmitted in an array, where the keys are the names, and the values are the required ratios. For example, if you specify two values containing A -> 50 and B -> 100, there will be 50 users with the value A, then there will be 100 users with the value B. It allows us to define how the testing will be distributed clearly.

use Orchid\Experiment\Experiment;
use Illuminate\Support\Facades\Cache;

$storage = Cache::store('redis');
$experiment = new Experiment('my-key', $storage);

$ab = $experiment->start([
    'A' => 50,
    'B' => 100,
]); // A or B

You can also install via your request:

http:://example.com?my-key=A

Cookie

I recommend putting this on middleware and immediately install a cookie using.

namespace App\Http\Middleware;

use Closure;
use Orchid\Experiment\Experiment;

class Experiments
{
    
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     *
     * @return mixed
     * @throws \Exception
     */
    public function handle($request, Closure $next)
    {
        $experiment = new Experiment('AB');

        $experiment->startAndSaveCookie([
            'A' => 50,
            'B' => 50,
        ]);
        
        return $next($request);
    }
}

It allows you to transfer data to Google analytics and similar services using javascript.

alert( document.cookie );

Laravel encrypts all cookies by default, so do not forget to specify your key in the exceptions app/Http/Middleware/EncryptCookies.php:

namespace App\Http\Middleware;

use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;

class EncryptCookies extends Middleware
{
    /**
     * The names of the cookies that should not be encrypted.
     *
     * @var array
     */
    protected $except = [
        'AB'
    ];
}

Blade

If you want to use the blade, you still must install the middleware after this call is as example:

@experiment('my-key', 'A')
    <button>Click me</button>
@else
    <button>Push me</button>
@endexperiment

Tests

php vendor/bin/phpunit --coverage-html ./logs/coverage ./tests

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].