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.

032PHP

Since May 25Pushed 5y ago1 watchersCompare

[ Source](https://github.com/richenzi/pairwise)[ Packagist](https://packagist.org/packages/richenzi/pairwise)[ RSS](/packages/richenzi-pairwise/feed)WikiDiscussions master Synced 1w 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

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity33

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

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

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