PHPackages                             richenzi/pairwise - 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. richenzi/pairwise

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

richenzi/pairwise
=================

Test with less test cases using pairwise technique.

032PHPCI failing

Since May 25Pushed 6y ago1 watchersCompare

[ Source](https://github.com/richenzi/pairwise)[ Packagist](https://packagist.org/packages/richenzi/pairwise)[ RSS](/packages/richenzi-pairwise/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Pairwise test case generator
============================

[](#pairwise-test-case-generator)

Inspired by Java implementation .

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

[](#installation)

With [Composer](https://getcomposer.org):

```
composer require richenzi/pairwise
```

Why?
----

[](#why)

> Pairwise (a.k.a. all-pairs) testing is an effective test case generation technique that is based on the observation that most faults are caused by interactions of at most two factors. Pairwise-generated test suites cover all combinations of two therefore are much smaller than exhaustive ones yet still very effective in finding defects.

Instead of exhaustive testing using all possible combination of all parameters, we generate just enough test cases to cover all of their pairs.

In our example below we have three parameters with five, four and five values. Total number of all combinations is 5x4x5 = 100. With pairwise technique we generate around 25 test cases. Not much, but with more parameters and with more values, the savings can be huge.

For one of our test (see /tests/files/generator/test\_3.txt), where number of all possible combinations reaches millions, pairwise gives you only few more than a hundred!

Usage
-----

[](#usage)

### From input

[](#from-input)

Generate test cases using direct input

```
$testCases = Pairwise::fromData([
    'browser' => ['Chrome', 'Firefox', 'Opera', 'Safari', 'IE'],
    'os' => ['Windows', 'Ubuntu', 'Debian', 'MacOS'],
    'connectivity' => ['Wi-Fi', 'LTE', '3G', '4G', '5G']
])->generate();
```

### From file

[](#from-file)

Just pass the path to you data file and that's it.

```
$testCases = Pairwise::fromFile('/path/to/file')->generate();
```

Parser expects file in parameter-per-row fashion. It means that each parameter values are on a single row, separated by a delimiter.

Example:

```
Chrome	Firefox	Opera	Safari	IE
Windows	Ubuntu	Debian	MacOS
Wi-Fi	LTE 3G	Slow	3G	5G

```

Default delimiter is tab, but you can tell the parser which one to use.

```
$testCases = Pairwise::fromFile('/path/to/file', [
    'delimiter' => ';'
])->generate();
```

Output
------

[](#output)

Generator returns an array of test cases. Each test case is an array with a combination of values - one value for each parameter.

```
[
    ['Chrome', 'Windows', 'Wi-Fi'],
    ['Chrome', 'MacOS', '5G'],
    ['Safari', 'Ubuntu', 'Wi-Fi'],
    // ...
];
```

License
-------

[](#license)

This package is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![richenzi](https://avatars.githubusercontent.com/u/9757783?v=4)](https://github.com/richenzi "richenzi (5 commits)")

### Embed Badge

![Health badge](/badges/richenzi-pairwise/health.svg)

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

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14429.2M361](/packages/dms-phpunit-arraysubset-asserts)[gong023/assert_chain

enable you to use phpunit assert with method chain

1478.9k3](/packages/gong023-assert-chain)

PHPackages © 2026

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