PHPackages                             sophie-spec/versus - 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. sophie-spec/versus

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

sophie-spec/versus
==================

A proof-of-concept unit tester for callables

0.1.4(6y ago)04MITPHPPHP &gt;=7.4.0

Since Dec 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/SophieSpec/versus)[ Packagist](https://packagist.org/packages/sophie-spec/versus)[ RSS](/packages/sophie-spec-versus/feed)WikiDiscussions master Synced yesterday

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

Versus
======

[](#versus)

Like [Ensure](https://github.com/SophieSpec/ensure), Versus is born with the thought that an ideal unit test should be a strict equality between the output of a function and its expected result. Versus enlarges Ensure tool so we can verify several inputs/ouputs with ease.

Install
-------

[](#install)

```
composer require --dev sophie-spec/versus
```

Requires PHP &gt;= 7.4.

Use
---

[](#use)

To test a method with several inputs/outputs, we simply pass the callable and yield values from a generator:

```
use function Sophie\Versus\versus;

$add = function ($a, $b) {
    return $a + $b;
};

versus($add, function () {
    yield [1, 2] => 3;
    yield [-2, -3] => -5;
    yield [10, -20] => -10;
});
```

If the assertion fails, a `Sophie\Ensure\FailedAssertionException` error is thrown with a detailed message:

```
versus($add, function () {
    yield [1, 2] => 100;
});
/*
    Both values are not equal.

    Provided value:
        3

    Expected value:
        100
*/
```

License
-------

[](#license)

[MIT](http://dreamysource.mit-license.org).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Total

5

Last Release

2236d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cfa0184a566f6328ade4c85c55bf01044302437b66214a710880e5387f015831?d=identicon)[sophie-spec](/maintainers/sophie-spec)

---

Tags

phpunitunittestcoverageassertXdebugspecphpspecatoumrspecsophie

###  Code Quality

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sophie-spec-versus/health.svg)

```
[![Health](https://phpackages.com/badges/sophie-spec-versus/health.svg)](https://phpackages.com/packages/sophie-spec-versus)
```

###  Alternatives

[nette/tester

Nette Tester: enjoyable unit testing in PHP with code coverage reporter. 🍏🍏🍎🍏

4917.3M1.5k](/packages/nette-tester)[friends-of-phpspec/phpspec-code-coverage

Generate Code Coverage reports for PhpSpec tests

202.6M125](/packages/friends-of-phpspec-phpspec-code-coverage)[elliotchance/concise

Concise is test framework for using plain English and minimal code, built on PHPUnit.

45223.8k4](/packages/elliotchance-concise)[colinodell/psr-testlogger

PSR-3 compliant test logger based on psr/log v1's, but compatible with v2 and v3 too!

1712.1M47](/packages/colinodell-psr-testlogger)[diablomedia/phpunit-pretty-printer

A PHPUnit result printer that shows per-file test progress and execution times

78515.2k5](/packages/diablomedia-phpunit-pretty-printer)[icecave/isolator

Dependency injection for global functions.

371.3M29](/packages/icecave-isolator)

PHPackages © 2026

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