PHPackages                             convertim/variantretriever - 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. convertim/variantretriever

ActiveLibrary

convertim/variantretriever
==========================

v1.0.1(3mo ago)03.1k↓34.6%MITPHPPHP &gt;=5.6CI failing

Since Feb 14Pushed 3mo agoCompare

[ Source](https://github.com/convertim/VariantRetriever)[ Packagist](https://packagist.org/packages/convertim/variantretriever)[ Docs](https://github.com/convertim/variantretriever)[ RSS](/packages/convertim-variantretriever/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (6)Used By (0)

VariantRetriever
================

[](#variantretriever)

VariantRetriever is a minimalist package for feature flagging. It's fast, database free and idempotent library to choose over a set of variants.

Getting Started
---------------

[](#getting-started)

First of all, you need to define an Experiment with a name and it variants. Variant requires 2 arguments, a name and a rollout percentage (50% by default). Then create a variant retriever with this experiment and variants, and ask it to retrieve a variant for a resource (in the following code, it's for a user uuid).

```
$variantRetriever = new VariantRetriever();
$experiment = new Experiment('my-ab-test', ...[new Variant('control1'), new Variant('variant2')]);
$variantRetriever->addExperiment($experiment);

$affectedVariant = $variantRetriever->getVariantForExperiment(new Experiment('my-ab-test'), '77d8a1d5-97ba-42db-a4a7-3b9562f0ff22');

var_dump((string) $affectedVariant); // string(7) "variant2"
```

### Running the Test Suite

[](#running-the-test-suite)

VariantRetriever uses [Pest PHP](https://pestphp.com) as testing framework. Once you have all dependencies installed via `composer install`, you can run the test suite with:

```
.php phing tests
```

To obtain the code coverage report, you'll need to have `xdebug` installed. Then, you can run:

```
.php phing tests-coverage
```

And this will give you detailed information about code coverage.

What about speed
----------------

[](#what-about-speed)

VariantRetriever is fast. In our test, we ensure that the retriever is able to get 50 000 variants to randomly generate different identifiables in less than 1 second. Local dev machine can run 500 000 runs in less than a second.

What about randomness
---------------------

[](#what-about-randomness)

RowsRolloutRolloutMax Rollout difference1k50/5046.5/46.53.5%500k50/5049.87/49.870.13%500k10\*109.880.12%500k10/10/809.88/9.88/79.920.12%

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance81

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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 ~485 days

Total

4

Last Release

98d ago

Major Versions

v0.0.2 → v1.0.02026-02-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/95036447?v=4)[convertim](/maintainers/convertim)[@convertim](https://github.com/convertim)

---

Top Contributors

[![xpacman01](https://avatars.githubusercontent.com/u/144683103?v=4)](https://github.com/xpacman01 "xpacman01 (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/convertim-variantretriever/health.svg)

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

PHPackages © 2026

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