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

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

sophie-spec/ensure
==================

Ensure that both arguments are equal

0.1.8(6y ago)0281MITPHPPHP &gt;=7.4.0

Since Dec 23Pushed 5y agoCompare

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

READMEChangelogDependencies (10)Versions (11)Used By (1)

Ensure
======

[](#ensure)

Ensure 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. Then, Ensure is that base tool for anything to test.

Install
-------

[](#install)

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

Requires PHP &gt;= 7.4.

Use
---

[](#use)

```
use function Sophie\Ensure\ensure;

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

ensure($add(1, 2), 3);
```

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

```
ensure($add(1, 2), 10);
/*
    Both values are not equal.

    Provided value:
        3

    Expected value:
        10
*/
```

More complex values are also well printed:

```
ensure(
    [
        'strawberry',
        'orange',
        'lime',
    ],
    [
        'orange',
        'lime',
        'strawberry',
    ],
);

/*
    Both values are not equal.

    Provided value:
        array:3 [
            0 => (10) "strawberry"
            1 => (6) "orange"
            2 => (4) "lime"
        ]

    Expected value:
        array:3 [
            0 => (6) "orange"
            1 => (4) "lime"
            2 => (10) "strawberry"
        ]
*/
```

License
-------

[](#license)

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

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity53

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

Recently: every ~23 days

Total

9

Last Release

2234d 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-ensure/health.svg)

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

###  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.6M124](/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)
