PHPackages                             comocode/laravel-ab - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. comocode/laravel-ab

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

comocode/laravel-ab
===================

Blade level AB tests for Laravel 5

0.3.0(9y ago)3339.4k14[3 issues](https://github.com/comocode/laravel-ab/issues)MITPHP

Since Aug 17Pushed 8y ago2 watchersCompare

[ Source](https://github.com/comocode/laravel-ab)[ Packagist](https://packagist.org/packages/comocode/laravel-ab)[ RSS](/packages/comocode-laravel-ab/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)DependenciesVersions (11)Used By (0)

[![Build Status](https://camo.githubusercontent.com/e841d3e12a58301297ffe9e0fdc6cfbfbec1114c8b4fc4541983424753917d42/68747470733a2f2f7472617669732d63692e6f72672f636f6d6f636f64652f6c61726176656c2d61622e706e67)](https://travis-ci.org/comocode/laravel-ab)[![Latest Stable Version](https://camo.githubusercontent.com/b8bad294cd2abac1a285ea9eee58b5424adb9c0dfc60d1e926d6aa3831e64bbc/68747470733a2f2f706f7365722e707567782e6f72672f636f6d6f636f64652f6c61726176656c2d61622f762f737461626c65)](https://packagist.org/packages/comocode/laravel-ab)[![Total Downloads](https://camo.githubusercontent.com/fffbae75d95145581cb4667ca2ff7181b9e1cec6b118a4cc128c2b451a5bc3de/68747470733a2f2f706f7365722e707567782e6f72672f636f6d6f636f64652f6c61726176656c2d61622f646f776e6c6f616473)](https://packagist.org/packages/comocode/laravel-ab)[![Latest Unstable Version](https://camo.githubusercontent.com/706e4d697d9c9430ded362ede7f8c5b6469b951f5f4123d68a0155f61b21468f/68747470733a2f2f706f7365722e707567782e6f72672f636f6d6f636f64652f6c61726176656c2d61622f762f756e737461626c65)](https://packagist.org/packages/comocode/laravel-ab)[![Daily Downloads](https://camo.githubusercontent.com/1b5a26d60a48c90eb186411f8d3c255ec903439a057f7c9f59a59f57df70056d/68747470733a2f2f706f7365722e707567782e6f72672f636f6d6f636f64652f6c61726176656c2d61622f642f6461696c79)](https://packagist.org/packages/comocode/laravel-ab)

laravel-ab
==========

[](#laravel-ab)

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

This will create trackable experients with as many conditions as you'd like. And will track conversion on each experiment based on keywords provided.

You can have nested experiments, its conditions are regular VIEW outputs making experiments easy to add/remove from your projects.

Usage
=====

[](#usage)

Install using composer or which ever means you prefer

```
composer install comocode/laravel-ab

```

then add the service provider to your app.php in config/ folder like so

```
    ..Illuminate\Validation\ValidationServiceProvider::class,

    ..Illuminate\View\ViewServiceProvider::class,

    ComoCode\LaravelAb\LaravelAbServiceProvider::class
```

Once you have registered the service provider. You can run `php artistan`and see the following output:

```
ab:migrate          migrates Laravel-Ab required tables

ab:rollback         removes Laravel-Ab tables

ab:report   --list outputs statistics on your current experiments or the one specified in the command

```

you can run ab:migrate to create the required tables, and ab:rollback to remove them anytime you wish to view your experiment results, use the export command to see statistics

Creating Experiments
====================

[](#creating-experiments)

There are a few PHP A/B and other Laravel packages available.

This project focuses on providing the ability to test multiple experiments including nested experiments with a very easy to use blade interface.

```

    @ab('My First Experiment') ///// the name of the experiment
    @condition('ConditionOne') /// one possible condition for the experiment

           @ab('My Nested Experiment') /// an experiment nested within the top experiment
                @condition('NestedConditionOne')
                    Some tag
                @condition('NestedConditionTwo') /// some values
                    Some other tag
                @condition('NestedConditionThree')
                    Another tag
            @track('NestedGoal') /// the goal to track this experiment to

    @condition('ConditionTwo')/// condition for top level test
         other stuff
    @track('TopLevelGoal') /// goal for top level test
```

to reach an event simply do

```
  @goal('NestedGoal')

```

in the targed page or by utilizing app()-&gt;make('Ab')-&gt;goal('NestedGoal') anywhere in your application execution.

### Weighted Conditions

[](#weighted-conditions)

if you would like to throttle the decision towards specific conditions you can add a declaration to control the distribution. For example

```
 @ab('My Nested Experiment') /// an experiment nested within the top experiment
    @condition('NestedConditionOne [2]')
        Some tag
    @condition('NestedConditionTwo [1]') /// some values
        Some other tag
    @condition('NestedConditionThree [1]')
        Another tag
@track('NestedGoal') /// the goal to track this experiment to
```

Will randomly select a result but will calculate the odd of the result based on the sum of the weights (1 + 1 + 2 = 4) vs its specific weight 2/4, 1/4 1/4.

Results
=======

[](#results)

Once an experiment is executed, it will remember the options provided to the user so experiment choice selections do not change upon revisiting your project.

A experiment is recorded per instance and goals are tracked to the instance allowing for aggregation on results per condition.

Contributing
============

[](#contributing)

Please feel free to contribute as A/B testing is an important part for any organization.

TODO
====

[](#todo)

Add queable job to send reports on cron Add HTML charts

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~42 days

Recently: every ~48 days

Total

9

Last Release

3591d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/953828bcdaaa860fa04f2747f20b70bb0f6efa411b775bcb8458d5b5b072f954?d=identicon)[comocode](/maintainers/comocode)

---

Top Contributors

[![82rules](https://avatars.githubusercontent.com/u/2653133?v=4)](https://github.com/82rules "82rules (50 commits)")[![sajjadrad](https://avatars.githubusercontent.com/u/1608837?v=4)](https://github.com/sajjadrad "sajjadrad (4 commits)")[![DODMax](https://avatars.githubusercontent.com/u/1137276?v=4)](https://github.com/DODMax "DODMax (1 commits)")[![jmarcher](https://avatars.githubusercontent.com/u/686843?v=4)](https://github.com/jmarcher "jmarcher (1 commits)")

---

Tags

laravelABab tests

### Embed Badge

![Health badge](/badges/comocode-laravel-ab/health.svg)

```
[![Health](https://phpackages.com/badges/comocode-laravel-ab/health.svg)](https://phpackages.com/packages/comocode-laravel-ab)
```

###  Alternatives

[highideas/laravel-users-online

This package will provide an online users management.

203113.2k1](/packages/highideas-laravel-users-online)[stephenjude/filament-blog

Filament Blog Builder

20317.8k](/packages/stephenjude-filament-blog)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[datomatic/nova-detached-actions

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

11229.2k](/packages/datomatic-nova-detached-actions)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
