PHPackages                             bravesheep/phpspec-expect - 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. bravesheep/phpspec-expect

AbandonedArchivedLibrary

bravesheep/phpspec-expect
=========================

Add the expect function for BDD style assertions

v0.2.0(6y ago)03.0k1[1 issues](https://github.com/bravesheep/phpspec-expect/issues)1MITPHP

Since Mar 31Pushed 6y ago3 watchersCompare

[ Source](https://github.com/bravesheep/phpspec-expect)[ Packagist](https://packagist.org/packages/bravesheep/phpspec-expect)[ RSS](/packages/bravesheep-phpspec-expect/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (1)

phpspec expect
==============

[](#phpspec-expect)

Adds the `expect(value)` function for you to your code, allowing you the same style of assertions that [phpspec](http://phpspec.net/) uses. Note that phpspec uses `should[matcher]` and `shouldNot[matcher]`, where this function also allows `to[matcher]` and `notTo[matcher]` calls. For more information of matchers take a look at the [phpspec documentation on matchers](http://phpspec.net/cookbook/matchers.html).

Adding custom matcher globally
------------------------------

[](#adding-custom-matcher-globally)

By calling `Bravesheep\PhpspecExpect\ContainerHolder::getInstance()->getContainer()` you can modify the phpspec ServiceContainer instance. You can add extra matchers for all your tests from that point on by adding an object starting with `matchers.matcher`, for example:

```
$container = \Bravesheep\PhpspecExpect\ContainerHolder::getInstance()->getContainer();
$container->setShared('matchers.matcher.my.custom.matcher', function (\PhpSpec\ServiceContainer $c) {
    return new My\Custom\Matcher($c->get('formatter.presenter'));
});

```

Note that shared objects will only be created once, whereas those added with `$container->set()` will be constructed again for every call made.

MatchersProviderInterface
-------------------------

[](#matchersproviderinterface)

If the object in which a call to `expect(value)` is made implements the `PhpSpec\Matcher\MatchersProviderInterface`then the matchers provided by that object are included in the available matchers.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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 ~1941 days

Total

2

Last Release

2481d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/86a9633404b0317dcde9ecb9c54f88c4d54bc42bb137d462933773bbe3a539b9?d=identicon)[rnijveld](/maintainers/rnijveld)

![](https://www.gravatar.com/avatar/664f27a4241e63b3e2cff68a436e2ef6930c926dd0ae0fb4973bfb969cab1754?d=identicon)[marlon](/maintainers/marlon)

---

Top Contributors

[![rnijveld](https://avatars.githubusercontent.com/u/193783?v=4)](https://github.com/rnijveld "rnijveld (9 commits)")[![hdoordt](https://avatars.githubusercontent.com/u/17907879?v=4)](https://github.com/hdoordt "hdoordt (1 commits)")

---

Tags

specificationBDDTDDspecphpspecSpecBDD

### Embed Badge

![Health badge](/badges/bravesheep-phpspec-expect/health.svg)

```
[![Health](https://phpackages.com/badges/bravesheep-phpspec-expect/health.svg)](https://phpackages.com/packages/bravesheep-phpspec-expect)
```

###  Alternatives

[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)[bossa/phpspec2-expect

Helper that decorates any SUS with a phpspec lazy object wrapper

741.8M87](/packages/bossa-phpspec2-expect)[ciaranmcnulty/phpspec-typehintedmethods

Extension for phpspec to enhance generated methods

3089.3k31](/packages/ciaranmcnulty-phpspec-typehintedmethods)[friends-of-phpspec/phpspec-code-coverage

Generate Code Coverage reports for PhpSpec tests

202.6M124](/packages/friends-of-phpspec-phpspec-code-coverage)[sofa/laravel-kahlan

Kahlan specs suite for testing Laravel applications

1524.2k](/packages/sofa-laravel-kahlan)

PHPackages © 2026

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