PHPackages                             bart/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. [Testing &amp; Quality](/categories/testing)
4. /
5. bart/ab

ActiveLibrary[Testing &amp; Quality](/categories/testing)

bart/ab
=======

A/B testing tool for Laravel apps

v1.1.0(8y ago)1310.6k↓75%3[1 PRs](https://github.com/bart/ab/pulls)MITPHPPHP &gt;=5.4.0

Since Jul 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/bart/ab)[ Packagist](https://packagist.org/packages/bart/ab)[ Docs](https://github.com/bart/ab)[ RSS](/packages/bart-ab/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Laravel A/B Testing
===================

[](#laravel-ab-testing)

AB is a server-side A/B testing tool for Laravel applications and provides a pretty simple feature set that is a great free alternative to services like Optimizely. It allows you to experiment with different variations of your website while test selection will be handled automatically.

Installation
------------

[](#installation)

Install using composer:

```
composer require bart/ab

```

Add the service provider to `app/config/app.php`:

```
Bart\Ab\ServiceProvider::class,

```

Register the AB alias:

```
'AB' => Bart\Ab\Facade::class,

```

Configuration
-------------

[](#configuration)

Publish the included configuration file like this:

```
php artisan vendor:publish --provider="Bart\Ab\ServiceProvider"

```

Next, edit the `config/packages/bart/ab/config.php` file. The following configuration options are available:

### Enabled

[](#enabled)

Enables or disbales the A/B testing.

```
'enabled' => true

```

### Default

[](#default)

If A/B testing is disbaled, `AB::getCurrentTest()` will return this.

```
'default' => 'none'

```

### Tests

[](#tests)

An array of test identifiers with an assigned level of distibution.

```
'tests' => [
    'teaser1' => 1,
    'teaser2' => 2,
    'teaser3' => 1,
]

```

The above (default) configuration will display teaser version 2 to 50% of your users, whereas version 1 and 3 will be displayed to 25% of your users each.

Usage
-----

[](#usage)

After you have defined your tests and enabled testing in the config you can start designing your A/B tests. It's as easy as 1-2-3 because the only thing you need to do is displaying a different peace of content for each test. Let's assume you have defined the tests from above, your view could look like this:

```
@test('teaser1')
    Teaser 1 is being displayed
@endtest

@test('teaser2')
    Teaser 2 is being displayed
@endtest

@test('teaser3')
    Teaser 3 is being displayed
@endtest

```

### Tracking

[](#tracking)

This package doesn't handle any goal or conversion tracking because every company is approaching this in a slightly different way. We would suggest to use a custom Google Analytics dimension and pass the assigned test version in your master view:

```
dataLayer.push({'version': '{{ AB::getCurrentTest() }}'});

```

Contribution and questions
--------------------------

[](#contribution-and-questions)

If you have any questions or suggestions please feel free to ask or create megre request. Happy testing!

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~100 days

Total

2

Last Release

3122d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d61306f91e18e357adc1eab181fdf6a8fd7d28cec97fca2420951d086a2cfff?d=identicon)[bart](/maintainers/bart)

---

Top Contributors

[![bart](https://avatars.githubusercontent.com/u/5200235?v=4)](https://github.com/bart "bart (2 commits)")

---

Tags

testinglaravelsplitoptimizelyAB

### Embed Badge

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

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

###  Alternatives

[jenssegers/ab

A server-side A/B testing tool for Laravel.

2955.6k](/packages/jenssegers-ab)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[laracasts/testdummy

Easy test stubs

4671.4M36](/packages/laracasts-testdummy)[sti3bas/laravel-scout-array-driver

Array driver for Laravel Scout

971.5M3](/packages/sti3bas-laravel-scout-array-driver)[davestewart/sketchpad

An innovative front-end environment for interactive Laravel development

29512.9k1](/packages/davestewart-sketchpad)[srlabs/laravel-testing-utilities

Helper utilities for testing Laravel Applications

1011.9k](/packages/srlabs-laravel-testing-utilities)

PHPackages © 2026

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