PHPackages                             ormin/phpspec-ddd-project-extension - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ormin/phpspec-ddd-project-extension

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ormin/phpspec-ddd-project-extension
===================================

PHPSpec helper classes for utilizing DDD and commonly used patterns around it

1.0.1(10y ago)122[1 issues](https://github.com/Ormin/phpspec-ddd-project-extension/issues)MITPHP

Since Oct 23Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Ormin/phpspec-ddd-project-extension)[ Packagist](https://packagist.org/packages/ormin/phpspec-ddd-project-extension)[ RSS](/packages/ormin-phpspec-ddd-project-extension/feed)WikiDiscussions master Synced 1mo ago

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

PhpSpecExtension
================

[](#phpspecextension)

Extension to help you speccing your domain objects.

Includes a matcher and token for value objects, which will make it possible to compare objects by their values and not internal identities within tests.

To install it, use Composer:

```
$ composer require --dev ormin/phpspec-ddd-project-extension:dev-master

```

Then in a `phpspec.yml` file of your project, add the following:

```
extensions:
    - Ormin\DDDProjectExtension\DDDProjectExtension
```

You can use the matcher like this ( in example I used an imagined UserId object, but you might use whatever Value Object you want ):

```

function it_will_return_the_correct_user_id() {

    $userId = new UserId(682);

    // $domainObject->returnMeSomeCoolUserId() will return a UserId value object, which we want to match against the above. ReturnValue will fail due to non-matching identity.
    $domainObject->returnMeSomeCoolUserId()->shouldReturnValue($userId);

}

```

You can use the token like this:

```

function it_will_call_funny_method() {

    $userId = new UserId(682);

    $domainObject->doSeriousStuff(new ExactValueObjectToken($userId))->shouldBeCalled();

    // $domainObject->doSomeFunnyStuff() should call doSeriousStuff(UserId $userId) with an UserId value object which is created inside the method, which we want to match against the above value object. Normal ExactValueToken will fail due to non-matching identity.
    $domainObject->doSomeFunnyStuff();

}

```

Warning: Do not abuse it for objects which are not explicitly value objects and are compared by identity! Every time you do it, a kitten dies, so please spare the kittens and write clean code :)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~125 days

Total

2

Last Release

3726d ago

### Community

Maintainers

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

---

Top Contributors

[![Ormin](https://avatars.githubusercontent.com/u/280476?v=4)](https://github.com/Ormin "Ormin (3 commits)")[![ifdattic](https://avatars.githubusercontent.com/u/966877?v=4)](https://github.com/ifdattic "ifdattic (2 commits)")

### Embed Badge

![Health badge](/badges/ormin-phpspec-ddd-project-extension/health.svg)

```
[![Health](https://phpackages.com/badges/ormin-phpspec-ddd-project-extension/health.svg)](https://phpackages.com/packages/ormin-phpspec-ddd-project-extension)
```

###  Alternatives

[memio/spec-gen

phpspec extension for better code generation

66204.3k28](/packages/memio-spec-gen)

PHPackages © 2026

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