PHPackages                             eloquent/phony-peridot - 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. eloquent/phony-peridot

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

eloquent/phony-peridot
======================

Phony integration for Peridot.

3.0.0(6y ago)63.7k↓27.3%12MITPHPPHP &gt;=7.2

Since Aug 5Pushed 2y ago1 watchersCompare

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

READMEChangelog (5)Dependencies (10)Versions (7)Used By (2)

> # No longer maintained
>
> [](#no-longer-maintained)
>
> This package is no longer maintained. See \[this statement\] for more info.
>
> \[this statement\]:  Phony for PHPUnit

Phony for Peridot
=================

[](#phony-for-peridot)

[![Current version image](https://camo.githubusercontent.com/f20d9000bf0d599bd644c9bbc954cd679f44da162bd8e66c8e9729a48924a083/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6f7175656e742f70686f6e792d70657269646f742e7376673f7374796c653d666c61742d737175617265 "This project uses semantic versioning")](https://packagist.org/packages/eloquent/phony-peridot)

Installation
------------

[](#installation)

```
composer require --dev eloquent/phony-peridot

```

See also
--------

[](#see-also)

- Read the [documentation](http://eloquent-software.com/phony/latest/).
- Read the [Peridot documentation](http://peridot-php.github.io/).
- Visit the [main Phony repository](https://github.com/eloquent/phony).

What is *Phony for Peridot*?
----------------------------

[](#what-is-phony-for-peridot)

*Phony for Peridot* is a plugin for the [Peridot](http://peridot-php.github.io/) testing framework that provides auto-wired test dependencies via the [Phony](http://eloquent-software.com/phony/latest/) mocking framework.

In other words, if a [Peridot](http://peridot-php.github.io/) test (or suite) requires a mock object, it can be defined to have a parameter with an appropriate [type declaration](http://php.net/functions.arguments#functions.arguments.type-declaration), and it will automatically receive a mock of that type as an argument when run.

[Stubs](http://eloquent-software.com/phony/latest/#stubs) for `callable` types, and "empty" values for other type declarations are also [supported](#supported-types).

Plugin installation
-------------------

[](#plugin-installation)

The plugin must be installed in the [Peridot configuration file](http://peridot-php.github.io/plugins.html):

```
use Eloquent\Phony\Peridot\PeridotPhony;
use Evenement\EventEmitterInterface;

return function (EventEmitterInterface $emitter) {
    PeridotPhony::install($emitter);
};
```

Dependency injection
--------------------

[](#dependency-injection)

Once the plugin is installed, any tests or suites that are defined with parameters will be supplied with matching arguments when run:

```
describe('Phony for Peridot', function () {
    it('Auto-wires test dependencies', function (PDO $db) {
        expect($db)->to->be->an->instanceof('PDO');
    });
});
```

### Injected mock objects

[](#injected-mock-objects)

*Phony for Peridot* supports automatic injection of [mock objects](http://eloquent-software.com/phony/latest/#mocks). Because [Phony](http://eloquent-software.com/phony/latest/) doesn't alter the interface of mocked objects, it is necessary to use [`on()`](http://eloquent-software.com/phony/latest/#facade.on) to retrieve the [mock handle](http://eloquent-software.com/phony/latest/#mock-handles) in order to perform [stubbing](http://eloquent-software.com/phony/latest/#stubs) and [verification](http://eloquent-software.com/phony/latest/#verification):

```
use function Eloquent\Phony\on;

describe('Phony for Peridot', function () {
    it('Supports stubbing', function (PDO $db) {
        on($db)->exec->with('DELETE FROM users')->returns(111);

        expect($db->exec('DELETE FROM users'))->to->equal(111);
    });

    it('Supports verification', function (PDO $db) {
        $db->exec('DROP TABLE users');

        on($db)->exec->calledWith('DROP TABLE users');
    });
});
```

### Injected stubs

[](#injected-stubs)

*Phony for Peridot* supports automatic injection of [stubs](http://eloquent-software.com/phony/latest/#stubs) for parameters with a `callable` type declaration:

```
describe('Phony for Peridot', function () {
    it('Supports callable stubs', function (callable $stub) {
        $stub->with('a', 'b')->returns('c');
        $stub('a', 'b');

        $stub->calledWith('a', 'b')->firstCall()->returned('c');
    });
});
```

Supported types
---------------

[](#supported-types)

The following table lists the supported type declarations, and the value supplied for each:

Parameter typeSupplied value*(none)*`null``bool``false``int``0``float``.0``string``''``array``[]``stdClass``(object) []``callable`[`stub()`](http://eloquent-software.com/phony/latest/#facade.stub)`Closure``function () {}``Generator``(function () {return; yield;})()`When using a [type declaration](http://php.net/functions.arguments#functions.arguments.type-declaration) that is not listed above, the supplied value will be a [mock](http://eloquent-software.com/phony/latest/#mocks) of the specified type.

By necessity, the supplied value will not be wrapped in a [mock handle](http://eloquent-software.com/phony/latest/#mock-handles). In order to obtain a handle, simply use [`on()`](http://eloquent-software.com/phony/latest/#facade.on):

```
use function Eloquent\Phony\on;

it('Example mock handle retrieval', function (ClassA $mock) {
    $handle = on($mock);
});
```

License
-------

[](#license)

For the full copyright and license information, please view the [LICENSE file](LICENSE).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~312 days

Total

5

Last Release

2325d ago

Major Versions

0.2.0 → 1.0.02017-04-24

1.0.0 → 2.0.02017-09-29

2.0.0 → 3.0.02020-01-06

PHP version history (3 changes)0.1.0PHP &gt;=5.4

2.0.0PHP &gt;=7

3.0.0PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/100152?v=4)[Erin](/maintainers/ezzatron)[@ezzatron](https://github.com/ezzatron)

---

Top Contributors

[![ezzatron](https://avatars.githubusercontent.com/u/100152?v=4)](https://github.com/ezzatron "ezzatron (70 commits)")

---

Tags

mockingmocking-frameworksperidotphpstubbingtestingmockingtestmockstubfakespyDummyDoubleperidotstubbing

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/eloquent-phony-peridot/health.svg)

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

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k497.0M23.6k](/packages/mockery-mockery)[icecave/isolator

Dependency injection for global functions.

371.3M29](/packages/icecave-isolator)[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)[phake/phake

The Phake mock testing library

4758.0M324](/packages/phake-phake)[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)

PHPackages © 2026

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