PHPackages                             dmt-software/ab-middleware - 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. dmt-software/ab-middleware

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

dmt-software/ab-middleware
==========================

ab testing middleware compatible with psr

0.0.14(4w ago)07.0k↓69.3%[1 PRs](https://github.com/dmt-software/ab-middleware/pulls)1MITPHPPHP ^8.3CI passing

Since Oct 29Pushed 4w ago2 watchersCompare

[ Source](https://github.com/dmt-software/ab-middleware)[ Packagist](https://packagist.org/packages/dmt-software/ab-middleware)[ RSS](/packages/dmt-software-ab-middleware/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (32)Versions (16)Used By (1)

PSR-15 ab testing middleware
============================

[](#psr-15-ab-testing-middleware)

This PSR-15 middleware allows you to do A/B testing on your application.

Cookies are used to keep track of a randomly generated user-id. Based on this cookie, a variant is selected for an experiment.

The Twig helper can be used to conditionally render the experiment template variants.

Although more than one experiment can be defined, only one experiment is supposed to be active at a time.

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

[](#installation)

```
composer require dmt-software/ab-middleware
```

Usage
-----

[](#usage)

```
use DMT\AbMiddleware\AbService;
use DMT\AbMiddleware\AbPsrMiddleware;

// define your experiments
$experiments = [
    'active-experiment' => [
        'variant-1' => 0.3,
        'variant-2' => 0.3,
        'control' => 0.4,
    ],
    'old-experiment' => [
        'variant-1' => 0.3,
        'variant-2' => 0.3,
        'control' => 0.4,
    ],
];

// instantiate the service
$service = new AbService($experiments);

// instantiate the middleware
$abMiddleware = new AbPsrMiddleware($service, 'ab-uid-cookie-name');

// add the middleware to your middleware stack
```

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance94

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

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

Recently: every ~58 days

Total

13

Last Release

29d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec6b7fbb4d231b5c2c76348cf3a13ec5e82c64a1826142f6ec0db1cf15db2873?d=identicon)[proggeler](/maintainers/proggeler)

![](https://www.gravatar.com/avatar/ea1df8d4eb476756f31e2c698e8b2c161c8be1b8482091f930abbddfd8d2fc52?d=identicon)[lingonl](/maintainers/lingonl)

---

Top Contributors

[![lingonl](https://avatars.githubusercontent.com/u/3777294?v=4)](https://github.com/lingonl "lingonl (23 commits)")[![KirosML](https://avatars.githubusercontent.com/u/123894927?v=4)](https://github.com/KirosML "KirosML (8 commits)")

---

Tags

ab-testingpsr-15

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dmt-software-ab-middleware/health.svg)

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

###  Alternatives

[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[mcp/sdk

Model Context Protocol SDK for Client and Server applications in PHP

1.5k1.5M87](/packages/mcp-sdk)[psr7-sessions/storageless

Storageless PSR-7 Session support

652405.7k8](/packages/psr7-sessions-storageless)[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

74149.4k30](/packages/jaxon-php-jaxon-core)[xima/xima-typo3-frontend-edit

Frontend Edit - This extension provides an edit button for editors within frontend content elements.

1414.3k](/packages/xima-xima-typo3-frontend-edit)[eliashaeussler/typo3-solver

Solver - Extends TYPO3's exception handling with AI generated solutions. Problems can also be solved from command line. Several OpenAI parameters are configurable and prompts and solution providers can be customized as desired.

302.1k](/packages/eliashaeussler-typo3-solver)

PHPackages © 2026

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