PHPackages                             peridot-php/leo - 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. peridot-php/leo

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

peridot-php/leo
===============

Next level assertion and matcher library for PHP

1.6.1(8y ago)36366.4k↓34%6[1 issues](https://github.com/peridot-php/leo/issues)[1 PRs](https://github.com/peridot-php/leo/pulls)20MITPHPPHP &gt;=5.4

Since Dec 20Pushed 3y ago3 watchersCompare

[ Source](https://github.com/peridot-php/leo)[ Packagist](https://packagist.org/packages/peridot-php/leo)[ RSS](/packages/peridot-php-leo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (15)Used By (20)

[![Leo logo](https://camo.githubusercontent.com/1357dbbc4410a36f287a65f7ecf36f529259cbbea07b87ad2a0e293165eef762/68747470733a2f2f7261772e6769746875622e636f6d2f70657269646f742d7068702f6c656f2f6d61737465722f6c656f2e706e67 "Leo logo")](https://camo.githubusercontent.com/1357dbbc4410a36f287a65f7ecf36f529259cbbea07b87ad2a0e293165eef762/68747470733a2f2f7261772e6769746875622e636f6d2f70657269646f742d7068702f6c656f2f6d61737465722f6c656f2e706e67)

Leo
===

[](#leo)

Next level assertion library for PHP

[![Current version image](https://camo.githubusercontent.com/92ec2515cdbd01677b61d1187946947ed326e4ef0e59bce9dfe71286e2991642/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70657269646f742d7068702f6c656f2e7376673f7374796c653d666c61742d737175617265 "This project uses semantic versioning")](https://packagist.org/packages/peridot-php/leo)[![Current build status image](https://camo.githubusercontent.com/fb9894bd60a535b6ed2ef0854c4228211d956b7e0be40d62a6c57ff63fa7ffd7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f70657269646f742d7068702f6c656f2f6d61737465722e7376673f7374796c653d666c61742d737175617265 "Current build status for the master branch")](https://travis-ci.org/peridot-php/leo)[![Current Scrutinizer code quality image](https://camo.githubusercontent.com/abca4cef6a78de7ee27ba81664e9b248a9e7c567ae19b2249dd9effe63a65b66/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f70657269646f742d7068702f6c656f2f6d61737465722e7376673f7374796c653d666c61742d737175617265 "Current Scrutinizer code quality for the master branch")](https://scrutinizer-ci.com/g/peridot-php/leo/?branch=master)[![Current coverage status image](https://camo.githubusercontent.com/0d35aa95c8cba12210fd8f722c32d0bf05638cce41f193fc8dfef978d34f0acb/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f70657269646f742d7068702f6c656f2f6d61737465722e7376673f7374796c653d666c61742d737175617265 "Current test coverage for the master branch")](https://codecov.io/github/peridot-php/leo)

Visit the main site and documentation at [peridot-php.github.io/leo/](http://peridot-php.github.io/leo/).

Expect Interface
----------------

[](#expect-interface)

Leo supports a chainable interface for writing assertions via the `expect`function:

```
expect($obj)->to->have->property('name');
expect($value)->to->be->ok
expect($fn)->to->throw('InvalidArgumentException', 'Expected message');
expect($array)->to->be->an('array');
expect($result)->to->not->be->empty;
```

Assert Interface
----------------

[](#assert-interface)

Leo supports a more object oriented, non-chainable interface via `Assert`:

```
use Peridot\Leo\Interfaces\Assert;

$assert = new Assert();
$assert->ok(true);
$assert->doesNotThrow($fn, 'Exception');
$assert->isResource(tmpfile());
$assert->notEqual($actual, $expected);
```

Detailed error messages
-----------------------

[](#detailed-error-messages)

Leo matchers generate detailed error messages for failed assertions:

[![Leo messages](https://camo.githubusercontent.com/01de5f4c588cb37073eb2e76d15e1c11cb87ae577113d00e88bd01cd1904f366/68747470733a2f2f7261772e6769746875622e636f6d2f70657269646f742d7068702f6c656f2f6d61737465722f6d6573736167652e706e67 "Leo messages")](https://camo.githubusercontent.com/01de5f4c588cb37073eb2e76d15e1c11cb87ae577113d00e88bd01cd1904f366/68747470733a2f2f7261772e6769746875622e636f6d2f70657269646f742d7068702f6c656f2f6d61737465722f6d6573736167652e706e67)

Plugins
-------

[](#plugins)

Leo can be easily customized. For an example see [LeoHttpFoundation](https://github.com/peridot-php/leo-http-foundation). Read more on the [plugin guide](http://peridot-php.github.io/leo/plugins.html).

Running Tests
-------------

[](#running-tests)

```
make test

```

Generating Docs
---------------

[](#generating-docs)

Documentation is generated via [ApiGen](http://apigen.org/). Simply run:

```
make docs

```

Thanks
------

[](#thanks)

Leo was inspired by several great projects:

- [Chai](http://chaijs.com/) for JS
- [Jasmine](http://jasmine.github.io/) for JS
- [Espérance](https://github.com/esperance/esperance) for PHP
- [Pho](https://github.com/danielstjules/pho) for PHP

And of course our work on [Peridot](http://peridot-php.github.io/) gave incentive to make a useful complement.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 89.7% 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 ~88 days

Recently: every ~228 days

Total

12

Last Release

3197d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.4.0

1.6.0PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/f71e23eec19a24f64f37c622e76e725c9a580f83ff40c411da9bad97e0a49089?d=identicon)[brianium](/maintainers/brianium)

---

Top Contributors

[![brianium](https://avatars.githubusercontent.com/u/636651?v=4)](https://github.com/brianium "brianium (210 commits)")[![ezzatron](https://avatars.githubusercontent.com/u/100152?v=4)](https://github.com/ezzatron "ezzatron (18 commits)")[![austinsmorris](https://avatars.githubusercontent.com/u/1616868?v=4)](https://github.com/austinsmorris "austinsmorris (2 commits)")[![mrkrstphr](https://avatars.githubusercontent.com/u/164472?v=4)](https://github.com/mrkrstphr "mrkrstphr (2 commits)")[![jmalloc](https://avatars.githubusercontent.com/u/761536?v=4)](https://github.com/jmalloc "jmalloc (1 commits)")[![mallorydxw](https://avatars.githubusercontent.com/u/2256130?v=4)](https://github.com/mallorydxw "mallorydxw (1 commits)")

---

Tags

testingassertmatcherexpectexpectation

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/peridot-php-leo/health.svg)

```
[![Health](https://phpackages.com/badges/peridot-php-leo/health.svg)](https://phpackages.com/packages/peridot-php-leo)
```

###  Alternatives

[phpunit/phpunit

The PHP Unit Testing framework.

20.0k910.7M134.8k](/packages/phpunit-phpunit)[phpunit/php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

8.9k892.4M1.5k](/packages/phpunit-php-code-coverage)[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k497.0M23.6k](/packages/mockery-mockery)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69417.9M510](/packages/spatie-phpunit-snapshot-assertions)[behat/mink

Browser controller/emulator abstraction for PHP

1.6k86.1M606](/packages/behat-mink)

PHPackages © 2026

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