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

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

teamgantt/phony
===============

Mocks, stubs, and spies for PHP.

v1.0.1(1y ago)09.4k↑46.7%1MITPHPPHP ^8.3

Since Nov 4Pushed 1y agoCompare

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

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

[![Phony](assets/readme/phony-logo-with-text.svg)](assets/readme/phony-logo-with-text.svg)

*Mocks, stubs, and spies for PHP.*

[![Current version image](https://camo.githubusercontent.com/4f22d8c2400cf5057d2395259cd5d5875b701cfb7d384c19d93717a46425936f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7465616d67616e74742f70686f6e792e7376673f7374796c653d666c61742d737175617265 "This project uses semantic versioning")](https://packagist.org/packages/teamgantt/phony)

[![Example verification output](https://camo.githubusercontent.com/e1452b329925d3d422565697e9b8797d595de01910458706878a9480144a838e/68747470733a2f2f61736369696e656d612e6f72672f612f37393433302e706e67 "Example verification output")](https://asciinema.org/a/79430)

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

[](#installation)

Available as various [Composer](https://getcomposer.org/) packages, depending on the test framework in use:

- For [Kahlan](https://kahlan.github.io/docs/), use [teamgantt/phony-kahlan](https://packagist.org/packages/teamgantt/phony-kahlan) and import `Eloquent\Phony\Kahlan`.
- For [PHPUnit](https://phpunit.de/), use [eloquent/phony-phpunit](https://packagist.org/packages/eloquent/phony-phpunit) and import `Eloquent\Phony\Phpunit`.
- For [Peridot](https://peridot-php.github.io/), use [eloquent/phony-peridot](https://packagist.org/packages/eloquent/phony-peridot) and import `Eloquent\Phony`.
- For other frameworks, or standalone usage, use [teamgantt/phony](https://packagist.org/packages/teamgantt/phony) and import `Eloquent\Phony`.

See the section on [Integration with test frameworks](https://eloquent-software.com/phony/latest/#integration-with-test-frameworks) in the [documentation](https://eloquent-software.com/phony/latest/).

Documentation
-------------

[](#documentation)

Full [documentation](https://eloquent-software.com/phony/latest/) is available.

What is *Phony*?
----------------

[](#what-is-phony)

*Phony* is a PHP library for creating various kinds of [test doubles](https://en.wikipedia.org/wiki/Test_double), including object [mocks](https://eloquent-software.com/phony/latest/#mocks), function [stubs](https://eloquent-software.com/phony/latest/#stubs), and function [spies](https://eloquent-software.com/phony/latest/#spies).

Why use *Phony*?
----------------

[](#why-use-phony)

### Support for language features, old and new

[](#support-for-language-features-old-and-new)

*Phony* is committed to supporting new PHP features as they emerge. Features that require workarounds in other mocking frameworks (such as passed-by-reference arguments), typically "just work" with *Phony*.

Amongst other features, *Phony* supports:

- Function-level [stubs](https://eloquent-software.com/phony/latest/#stubs) and [spies](https://eloquent-software.com/phony/latest/#spies), which negate the need for object mocking in many cases
- Generator [stubbing](https://eloquent-software.com/phony/latest/#stubbing-generators) and [verification](https://eloquent-software.com/phony/latest/#generator-and-iterable-verification)
- [Mocking of traits](https://eloquent-software.com/phony/latest/#mocking-basics)
- [Stubbing of functions and methods with return types](https://eloquent-software.com/phony/latest/#default-values-for-return-types)
- Modern [variable-length argument lists](https://php.net/functions.arguments#functions.variable-arg-list) using the `...` token
- [Setting of passed-by-reference arguments](https://eloquent-software.com/phony/latest/#setting-passed-by-reference-arguments), and reference arguments in general

### Zero-configuration integrations

[](#zero-configuration-integrations)

Integrating *Phony* with your favorite test framework is as simple as [choosing the correct namespace to import](https://eloquent-software.com/phony/latest/#integration-with-test-frameworks). Complimentary features make integrations seamless and intuitive:

- [No configuration or bootstrap code necessary](https://eloquent-software.com/phony/latest/#integration-with-test-frameworks)
- [Most test frameworks need no special treatment](https://eloquent-software.com/phony/latest/#integration-with-test-frameworks)
- Tight integration with [Kahlan](https://eloquent-software.com/phony/latest/#kahlan-usage) and [PHPUnit](https://eloquent-software.com/phony/latest/#phpunit-usage)
- [Can be used standalone, too](https://eloquent-software.com/phony/latest/#standalone-usage)
- Supports matchers from [Hamcrest](https://eloquent-software.com/phony/latest/#hamcrest-matchers), [Kahlan](https://eloquent-software.com/phony/latest/#kahlan-argument-matchers), and [PHPUnit](https://eloquent-software.com/phony/latest/#phpunit-constraints)

Interested in better integration with other test frameworks? So are we! Just open a [GitHub issue](https://github.com/eloquent/phony/issues) if there's something we can do.

### Refined verification output

[](#refined-verification-output)

*Phony* has received a great deal of work and refinement where the rubber meets the road; in its [verification output](https://eloquent-software.com/phony/latest/#understanding-verification-output):

[![Example verification output](https://camo.githubusercontent.com/d04962ab1978955e704a83da88afa8be96a0ff7fbe6a855cea32c24c36b415c6/68747470733a2f2f656c6f7175656e742d736f6674776172652e636f6d2f70686f6e792f6c61746573742f696d672f766572696669636174696f6e2e737667)](https://camo.githubusercontent.com/d04962ab1978955e704a83da88afa8be96a0ff7fbe6a855cea32c24c36b415c6/68747470733a2f2f656c6f7175656e742d736f6674776172652e636f6d2f70686f6e792f6c61746573742f696d672f766572696669636174696f6e2e737667)

*Phony*'s output includes succinct but detailed information that is focused on helping you find the cause of the failure as fast as possible. Where appropriate, the output uses [difference comparison and color](https://eloquent-software.com/phony/latest/#understanding-verification-output) to further highlight important details.

### First-class support for functions and callbacks

[](#first-class-support-for-functions-and-callbacks)

*Phony* is designed to provide support for testing both object-based, and function-based systems. In *Phony*, object mocks are built upon full-featured function level [stubs](https://eloquent-software.com/phony/latest/#stubs) and [spies](https://eloquent-software.com/phony/latest/#spies).

This focus on support for procedural programming allows *Phony* to handle many situations that cannot be handled by solely class-based mocking frameworks. Since *Phony*'s class-level support is based upon its function-level support, the interfaces are consistent, and require very little extra knowledge to use.

### Extensive feature set

[](#extensive-feature-set)

*Phony* has an extensive and powerful feature set. For detailed information on a particular feature, select one of the following:

- [Mock objects](https://eloquent-software.com/phony/latest/#mocks)
    - [Mocking of classes, interfaces, and traits](https://eloquent-software.com/phony/latest/#mocking-basics)
    - [Mocking of multiple types simultaneously](https://eloquent-software.com/phony/latest/#mocking-multiple-types)
    - [Partial mocks](https://eloquent-software.com/phony/latest/#partial-mocks)
    - [Proxy mocks for `final` classes](https://eloquent-software.com/phony/latest/#proxy-mocks)
    - [Mock classes with custom methods and properties](https://eloquent-software.com/phony/latest/#ad-hoc-mocks)
    - [Constructor bypassing, and manual constructor calling](https://eloquent-software.com/phony/latest/#calling-a-constructor-manually)
    - [Static method mocking](https://eloquent-software.com/phony/latest/#static-mocks)
    - [Mocking of fluent interfaces](https://eloquent-software.com/phony/latest/#returning-the-self-value)
    - [Customizable class names](https://eloquent-software.com/phony/latest/#builder.named)
    - [Mock builders for advanced usage](https://eloquent-software.com/phony/latest/#mock-builders)
- [Stubbing](https://eloquent-software.com/phony/latest/#stubs)
    - Returning of [specific values](https://eloquent-software.com/phony/latest/#returning-values), [arguments](https://eloquent-software.com/phony/latest/#returning-arguments), and [more](https://eloquent-software.com/phony/latest/#returning-the-self-value)
    - [Throwing of exceptions](https://eloquent-software.com/phony/latest/#throwing-exceptions)
    - [Replacement of behavior with another callback](https://eloquent-software.com/phony/latest/#using-a-callable-as-an-answer)
    - [Conditional use of the original function or method](https://eloquent-software.com/phony/latest/#forwarding-to-the-original-callable)
    - [Returning of generators with customizable behavior](https://eloquent-software.com/phony/latest/#stubbing-generators)
    - [Multiple actions can be performed in a single invocation](https://eloquent-software.com/phony/latest/#answers-that-perform-multiple-actions)
- [Spying](https://eloquent-software.com/phony/latest/#spies)
    - Verify-after-running style produces more durable tests than outdated [expect-run-verify](https://web.archive.org/web/20180824034235/http://monkeyisland.pl/2008/02/01/deathwish/) style
    - Verification of [calls](https://eloquent-software.com/phony/latest/#verifying-that-a-call-was-made) and [call arguments](https://eloquent-software.com/phony/latest/#verifying-that-a-spy-was-called-with-specific-arguments)
    - Verification of [return values](https://eloquent-software.com/phony/latest/#verifying-spy-return-values) and [thrown exceptions](https://eloquent-software.com/phony/latest/#verifying-spy-exceptions)
    - Verification of [generators](https://eloquent-software.com/phony/latest/#generator-and-iterable-verification)
    - [Verification of other iterables](https://eloquent-software.com/phony/latest/#generator-and-iterable-verification)
    - [Order verification](https://eloquent-software.com/phony/latest/#order-verification)
    - [Individual call level verification](https://eloquent-software.com/phony/latest/#calls)
    - [Retrieval of call arguments](https://eloquent-software.com/phony/latest/#verifying-that-a-spy-was-called-with-specific-arguments)
- And [more](https://eloquent-software.com/phony/latest/)...

Help
----

[](#help)

For help with a difficult testing scenario, questions regarding how to use *Phony*, or to report issues with *Phony* itself, please open a [GitHub issue](https://github.com/eloquent/phony/issues)so that others may benefit from the outcome.

Alternatively, [@ezzatron](https://github.com/ezzatron) may be contacted directly via [Twitter](https://twitter.com/ezzatron).

Usage
-----

[](#usage)

For detailed usage, see the [documentation](https://eloquent-software.com/phony/latest/).

### Example test suites

[](#example-test-suites)

See the [phony-examples](https://github.com/eloquent/phony-examples) repository.

### Standalone usage

[](#standalone-usage)

Install the [teamgantt/phony](https://packagist.org/packages/teamgantt/phony) package, then:

```
use function Eloquent\Phony\mock;

$handle = mock('ClassA');
$handle->methodA->with('argument')->returns('value');

$mock = $handle->get();

assert($mock->methodA('argument') === 'value');
$handle->methodA->calledWith('argument');
```

### [Kahlan](https://kahlan.github.io/docs/) usage

[](#kahlan-usage)

Install the [teamgantt/phony-kahlan](https://packagist.org/packages/teamgantt/phony-kahlan) package, then:

```
use function Eloquent\Phony\Kahlan\mock;

describe('Phony', function () {
    it('integrates with Kahlan', function () {
        $handle = mock('ClassA');
        $handle->methodA->with('argument')->returns('value');

        $mock = $handle->get();

        expect($mock->methodA('argument'))->toBe('value');
        $handle->methodA->calledWith('argument');
    });
});
```

The [teamgantt/phony-kahlan](https://packagist.org/packages/teamgantt/phony-kahlan) package also provides auto-wired mocks:

```
use function Eloquent\Phony\Kahlan\on;

describe('Phony for Kahlan', function () {
    it('supports auto-wiring', function (ClassA $mock) {
        $handle = on($mock);
        $handle->methodA->with('argument')->returns('value');

        expect($mock->methodA('argument'))->toBe('value');
        $handle->methodA->calledWith('argument');
    });
});
```

### [Peridot](https://peridot-php.github.io/) usage

[](#peridot-usage)

Install the [eloquent/phony-peridot](https://packagist.org/packages/eloquent/phony-peridot) package, then:

```
use function Eloquent\Phony\mock;

describe('Phony', function () {
    it('integrates with Peridot', function () {
        $handle = mock('ClassA');
        $handle->methodA->with('argument')->returns('value');

        $mock = $handle->get();

        expect($mock->methodA('argument'))->to->equal('value');
        $handle->methodA->calledWith('argument');
    });
});
```

The [eloquent/phony-peridot](https://packagist.org/packages/eloquent/phony-peridot) package also provides auto-wired mocks:

```
use function Eloquent\Phony\on;

describe('Phony for Peridot', function () {
    it('supports auto-wiring', function (ClassA $mock) {
        $handle = on($mock);
        $handle->methodA->with('argument')->returns('value');

        expect($mock->methodA('argument'))->to->equal('value');
        $handle->methodA->calledWith('argument');
    });
});
```

### [PHPUnit](https://phpunit.de/) usage

[](#phpunit-usage)

Install the [eloquent/phony-phpunit](https://packagist.org/packages/eloquent/phony-phpunit) package, then:

```
use Eloquent\Phony\Phpunit\Phony;

class PhonyTest extends PHPUnit_Framework_TestCase
{
    public function testIntegration()
    {
        $handle = Phony::mock('ClassA');
        $handle->methodA->with('argument')->returns('value');

        $mock = $handle->get();

        $this->assertSame('value', $mock->methodA('argument'));
        $handle->methodA->calledWith('argument');
    }
}
```

Inception
---------

[](#inception)

Please forgive me if this section is opinionated, or if I recall some particular detail of a framework incorrectly. But if you want a TL;DR for why I created *Phony*, basically:

- [Phake](https://phake.readthedocs.org/) doesn't support [traits](https://php.net/traits), and once upon a time, *didn't* support [HHVM](https://hhvm.com/).
- [PHPUnit](https://phpunit.de/) and [Mockery](https://docs.mockery.io/) both implement [expect-run-verify](https://web.archive.org/web/20180824034235/http://monkeyisland.pl/2008/02/01/deathwish/) style mocks, which are evil.
- [Prophecy](https://github.com/phpspec/prophecy) doesn't support the features that I need.
- [SimpleTest](https://github.com/simpletest/simpletest) is ancient.
- I hadn't heard of anything else that sounded promising.

The first mocking framework I used was *probably* [SimpleTest](https://github.com/simpletest/simpletest)'s. Unfortunately, that's a long time ago now, and I didn't really understand mocking at the time. And to top it off, I can't even remember how [SimpleTest](https://github.com/simpletest/simpletest)'s mocks functioned. So let's skip ahead to the first mocking framework I really explored in depth, which was [PHPUnit](https://phpunit.de/)'s.

When I first discovered [PHPUnit](https://phpunit.de/)'s mocks, they were revolutionary to me. They allowed me to test things *really* thoroughly, in ways I didn't even know were possible previously. Although [PHPUnit](https://phpunit.de/)'s mocking was likely a port of some existing Java mocking system, it was the framework that first opened my eyes to the real potential of test doubles.

Unfortunately it wasn't all sunshine and roses. [PHPUnit](https://phpunit.de/)'s mocks were difficult to use, and especially, because of the [expect-run-verify](https://web.archive.org/web/20180824034235/http://monkeyisland.pl/2008/02/01/deathwish/) style interface, they were difficult to *re*-use. There was no way to "un-expect" something in a particular test, and when something failed, the true cause of the failure was often difficult to determine.

While searching for a better solution, I stumbled across [Phake](https://phake.readthedocs.org/), which was inspired by Java's *extremely* popular [Mockito](https://site.mockito.org/) mocking framework. [Phake](https://phake.readthedocs.org/) was, and still is, an excellent mocking framework. Both [Mockito](https://site.mockito.org/) and [Phake](https://phake.readthedocs.org/) eschew the [expect-run-verify](https://web.archive.org/web/20180824034235/http://monkeyisland.pl/2008/02/01/deathwish/) pattern, to great benefit.

By treating stubbing and verification as separate concepts, [Phake](https://phake.readthedocs.org/) essentially fixed all of the problems I had with [PHPUnit](https://phpunit.de/)'s mocks. Mocks could be re-used easily, and when a test failed, the cause was (usually) clear. I was sold on the evils of [expect-run-verify](https://web.archive.org/web/20180824034235/http://monkeyisland.pl/2008/02/01/deathwish/), and swore never to go back.

I believe it was around this time that I heard of [Mockery](https://docs.mockery.io/). Although I was fairly happy with [Phake](https://phake.readthedocs.org/), it *did* have a few little oddities, such as the way it deals with by-reference arguments, and mocking of [traits](https://php.net/traits) was not possible. So I checked out [Mockery](https://docs.mockery.io/), but was immediately put off by its use of expectations; which I felt would have been a huge step backwards.

In fairness, it's possible that [Mockery](https://docs.mockery.io/) supports other mocking methods, but since the "primary" way it works seems to be based around [expect-run-verify](https://web.archive.org/web/20180824034235/http://monkeyisland.pl/2008/02/01/deathwish/), I've never considered it a viable candidate, and have never used it.

At some point around this time I worked on a Node.js project, and explored a handful of the most popular Node mocking frameworks, before settling on the excellent [Sinon.JS](https://sinonjs.org/). Its focus on callback-based stubbing and spying, and its extensive verification API would eventually influence *Phony* heavily.

It wasn't until [HHVM](https://hhvm.com/) became a viable option in the PHP world that I really had to consider using something other than [Phake](https://phake.readthedocs.org/). I had wanted for a while to start experimenting with [HHVM](https://hhvm.com/) in my projects. Unfortunately [Phake](https://phake.readthedocs.org/) had issues that prevented the test suite from even *running* under [HHVM](https://hhvm.com/), so it was immediately a problem.

One of my co-workers had intended to work on [HHVM](https://hhvm.com/) support for [Phake](https://phake.readthedocs.org/), but unfortunately it seemed at that time as though work on [Phake](https://phake.readthedocs.org/) had stagnated, and it took over a month just to get a [PR](https://github.com/mlively/Phake/pull/133) accepted that added [HHVM](https://hhvm.com/) as a test target. To [Phake](https://phake.readthedocs.org/)'s credit, [HHVM](https://hhvm.com/) *is* now supported, and hindsight has taught me that HHVM support is **hard**.

One project that showed promise was [Prophecy](https://github.com/phpspec/prophecy), an "opinionated" mocking framework that arose from the [phpspec](https://phpspec.net/) testing framework. While I disliked its use of abstract terms like "prophesize" and "reveal" for method names, the core idea of a separate object instance that can be used to control the actual mock worked really well. So well, in fact, that I would eventually end up using this concept in *Phony*.

Importantly, [Prophecy](https://github.com/phpspec/prophecy) already supported [HHVM](https://hhvm.com/), and seemed like a great fit to replace [Phake](https://phake.readthedocs.org/); until I ran into the "opinionated" side of [Prophecy](https://github.com/phpspec/prophecy)'s nature. One thing that [Prophecy](https://github.com/phpspec/prophecy) does *not* support is order verification. For example; verifying that your code opens a file before writing to it. It seemed to me to be a feature whose benefits are self-evident, but the [Prophecy](https://github.com/phpspec/prophecy) developers unfortunately [did not agree](https://github.com/phpspec/prophecy/issues/130).

So, fool that I am, I thought "How hard can it be?" and started work on *Phony*, a mocking framework designed to combine the strengths of its predecessors, and allow testing under [HHVM](https://hhvm.com/) without compromise.

New versions of PHP came along and introduced new language features, and *Phony*adapted to meet the requirements of testing these features. I was also fortunate enough to be part of a development team at my day job, who were willing to be the test bed for *Phony*, and it received a lot of real-world usage that contributed immensely to *Phony*'s stability and eventual feature set.

Of course it turned into a much longer journey than I first expected, and *Phony* continues to be a challenging project to maintain. But for me, it's an invaluable tool that I use almost every day, and I hope it can be the same for you.

Thanks for listening.

> Erin ([@ezzatron](https://github.com/ezzatron))

Thanks
------

[](#thanks)

Special thanks to the following people:

- [@jmalloc](https://github.com/jmalloc), [@koden-km](https://github.com/koden-km), [@parkertr](https://github.com/parkertr), and [@darianbr](https://github.com/darianbr) for their invaluable help as test subjects.
- [@szczepiq](https://github.com/szczepiq), and everyone who contributed to [Mockito](https://site.mockito.org/).
- [@mlively](https://github.com/mlively), and everyone who contributed to [Phake](https://phake.readthedocs.org/).
- [@cjohansen](https://github.com/cjohansen), and everyone who contributed to [Sinon.JS](https://sinonjs.org/).
- [@everzet](https://github.com/everzet), and everyone who contributed to [Prophecy](https://github.com/phpspec/prophecy).
- [@sebastianbergmann](https://github.com/sebastianbergmann), and everyone who contributed to [PHPUnit](https://phpunit.de/).
- [@jails](https://github.com/jails), and everyone who contributed to [Kahlan](https://kahlan.github.io/docs/).

License
-------

[](#license)

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

Note
----

[](#note)

This is a fork of the now unmaintained [eloquent/phony](https://packagist.org/packages/eloquent/phony). The original purpose of this fork was to allow for compatibility with PHP 8.3. Be aware that we do not intend to regularly maintain this other than to keep it up to date with PHP as needed.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.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 ~1 days

Total

2

Last Release

559d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/59413656492e3afbb7bb42fa9a5bc7ebce978a48da7ac2e5a8cf7e7f6ef6b5c2?d=identicon)[johncorrelli](/maintainers/johncorrelli)

---

Top Contributors

[![ezzatron](https://avatars.githubusercontent.com/u/100152?v=4)](https://github.com/ezzatron "ezzatron (1259 commits)")[![jmalloc](https://avatars.githubusercontent.com/u/761536?v=4)](https://github.com/jmalloc "jmalloc (19 commits)")[![nathanetech](https://avatars.githubusercontent.com/u/25019752?v=4)](https://github.com/nathanetech "nathanetech (7 commits)")[![keksa](https://avatars.githubusercontent.com/u/7985651?v=4)](https://github.com/keksa "keksa (2 commits)")[![danepowell](https://avatars.githubusercontent.com/u/1984514?v=4)](https://github.com/danepowell "danepowell (2 commits)")[![johncorrelli](https://avatars.githubusercontent.com/u/18272064?v=4)](https://github.com/johncorrelli "johncorrelli (2 commits)")[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (1 commits)")[![darianbr](https://avatars.githubusercontent.com/u/1787188?v=4)](https://github.com/darianbr "darianbr (1 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (1 commits)")

---

Tags

mockingtestmockstubfakespyDummyDoublestubbing

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  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)
