PHPackages                             tomzx/ditto - 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. tomzx/ditto

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

tomzx/ditto
===========

Specification-oriented BDD helpers for PHPUnit

v0.2.0(10y ago)21.8k1[2 issues](https://github.com/tomzx/ditto/issues)1MITPHPPHP &gt;=5.4CI failing

Since Jun 6Pushed 5y ago1 watchersCompare

[ Source](https://github.com/tomzx/ditto)[ Packagist](https://packagist.org/packages/tomzx/ditto)[ Docs](https://github.com/tomzx/ditto)[ RSS](/packages/tomzx-ditto/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (2)Versions (5)Used By (1)

Ditto
=====

[](#ditto)

[![License](https://camo.githubusercontent.com/6da6e78ae997e3e856b7bb89f8d207538e12d5bab53d4fbb623d2063697503b8/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f646974746f2f6c6963656e73652e737667)](https://packagist.org/packages/tomzx/ditto)[![Latest Stable Version](https://camo.githubusercontent.com/dc0f984c18a9e2c305c29209dacfb76d576858c5e89b9399cd531b843d26255b/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f646974746f2f762f737461626c652e737667)](https://packagist.org/packages/tomzx/ditto)[![Latest Unstable Version](https://camo.githubusercontent.com/aa50ab4b6e4ba1a251eee6018680a993e9b2045287e695e98915a6c45577338a/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7a782f646974746f2f762f756e737461626c652e737667)](https://packagist.org/packages/tomzx/ditto)[![Build Status](https://camo.githubusercontent.com/7240a24d5f0a49db137c8bc0bc046f2542f04526afaa79a8a759e1925f7d0084/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f6d7a782f646974746f2e737667)](https://travis-ci.org/tomzx/ditto)[![Code Quality](https://camo.githubusercontent.com/cf4cbbd7d8a5e8623f4866ee624636bb903159c50ee7591a0164b15aaf29f122/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f6d7a782f646974746f2e737667)](https://scrutinizer-ci.com/g/tomzx/ditto/code-structure)[![Code Coverage](https://camo.githubusercontent.com/acb831eec95f0ec72b21540bfee6142aeca50f2ed8ae2a87cc16764761a091e2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f6d7a782f646974746f2e737667)](https://scrutinizer-ci.com/g/tomzx/ditto)[![Total Downloads](https://camo.githubusercontent.com/e4905ea5b0a9b9251b89ba53e07e9dc8487a3ca09ebcf7eff5311f4c9a5f6ba1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6d7a782f646974746f2e737667)](https://packagist.org/packages/tomzx/ditto)

What is Ditto?
--------------

[](#what-is-ditto)

Ditto is a simple wrapper around PHPUnit assertions which allows developers to use a syntax similar to the one provided by [phpspec matchers](http://www.phpspec.net/docs/introduction.html#matchers). With it, you can replace your calls to `assertSame`, `assertEquals` and `assertInstanceOf`.

Usage
-----

[](#usage)

```
use Ditto\Ditto as d;

// Before PHP 5.5
$ditto = d::make('SomeClass');
// As of PHP 5.5
$ditto = d::make(SomeClass::class);

$ditto->someMethod()->shouldReturn('some value');

// ===
$ditto->someMethod()->shouldReturn('some value');
$ditto->someMethod()->shouldBe('some value');
$ditto->someMethod()->shouldEqual('some value');
$ditto->someMethod()->shouldBeEqualTo('some value');

// ==
$ditto->someMethod()->shouldBeLike('some value');

// instanceof
$ditto->someMethod()->shouldHaveType('SomeType');
$ditto->someMethod()->shouldReturnAnInstanceOf('SomeType');
$ditto->someMethod()->shouldBeAnInstance('SomeType');
$ditto->someMethod()->shouldImplement('SomeType');

// It also works on intrinsic values
$ditto = d::make('this is nice');
$ditto->shouldReturn('this is nice');

$ditto = d::make(15);
$ditto->shouldBe(15);
```

Contributing to Ditto
---------------------

[](#contributing-to-ditto)

**All issues and pull requests should be filed on the [tomzx/ditto](http://github.com/tomzx/ditto) repository.**

License
-------

[](#license)

The code is licensed under the [MIT license](http://choosealicense.com/licenses/mit/). See [LICENSE](LICENSE).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~469 days

Total

2

Last Release

3894d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/218f6db237e6937c05550d4d6df648f50cd9b26b098fc8c1be3930fe7d5c71e9?d=identicon)[tomzx](/maintainers/tomzx)

---

Top Contributors

[![tomzx](https://avatars.githubusercontent.com/u/188960?v=4)](https://github.com/tomzx "tomzx (20 commits)")[![xel1045](https://avatars.githubusercontent.com/u/1497697?v=4)](https://github.com/xel1045 "xel1045 (4 commits)")

---

Tags

testBDDditto

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tomzx-ditto/health.svg)

```
[![Health](https://phpackages.com/badges/tomzx-ditto/health.svg)](https://phpackages.com/packages/tomzx-ditto)
```

###  Alternatives

[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k497.0M23.6k](/packages/mockery-mockery)[php-mock/php-mock

PHP-Mock can mock built-in PHP functions (e.g. time()). PHP-Mock relies on PHP's namespace fallback policy. No further extension is needed.

36918.1M98](/packages/php-mock-php-mock)[php-mock/php-mock-phpunit

Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.

1718.2M399](/packages/php-mock-php-mock-phpunit)[polishsymfonycommunity/symfony-mocker-container

Provides base Symfony dependency injection container enabling service mocking.

1468.0M237](/packages/polishsymfonycommunity-symfony-mocker-container)[dvdoug/behat-code-coverage

Generate Code Coverage reports for Behat tests

593.6M37](/packages/dvdoug-behat-code-coverage)[php-mock/php-mock-mockery

Mock built-in PHP functions (e.g. time()) with Mockery. This package relies on PHP's namespace fallback policy. No further extension is needed.

392.1M96](/packages/php-mock-php-mock-mockery)

PHPackages © 2026

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