PHPackages                             phake/phake - 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. phake/phake

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

phake/phake
===========

The Phake mock testing library

v4.7.0(3mo ago)4758.0M↓11.3%86[13 issues](https://github.com/phake/Phake/issues)[6 PRs](https://github.com/phake/Phake/pulls)20BSD-3-ClausePHPPHP ^7.1|^8.0CI passing

Since May 14Pushed 3mo ago21 watchersCompare

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

READMEChangelog (10)Dependencies (6)Versions (63)Used By (20)

Phake
=====

[](#phake)

[![Tests](https://github.com/phake/phake/actions/workflows/tests.yml/badge.svg)](https://github.com/phake/phake/actions/workflows/tests.yml)[![Latest Stable Version](https://camo.githubusercontent.com/ec6a0b42393792ac5991935975b114a49650a0d447b2b52cf194988c4f32a29b/687474703a2f2f706f7365722e707567782e6f72672f7068616b652f7068616b652f76)](https://packagist.org/packages/phake/phake)[![Total Downloads](https://camo.githubusercontent.com/dae2c93c020f2acc15ca43db19c6b3abd803cd37b6b3f4304eedbef9b71981b2/687474703a2f2f706f7365722e707567782e6f72672f7068616b652f7068616b652f646f776e6c6f616473)](https://packagist.org/packages/phake/phake)[![License](https://camo.githubusercontent.com/4963ce0194c798993e6bc87e610e791a0e97342b23cbc7c954a56c9a1121bc82/687474703a2f2f706f7365722e707567782e6f72672f7068616b652f7068616b652f6c6963656e7365)](https://packagist.org/packages/phake/phake)

Phake is a framework for PHP that aims to provide mock objects, test doubles and method stubs.

Phake was inspired by a lack of flexibility and ease of use in the current mocking frameworks combined with a recent experience with Mockito for Java.

A key conceptual difference in mocking between Phake and most of php mocking frameworks (ie: mock functionality in PHPUnit, PHPMock, and mock functionality in SimpleTest) is that Phake (like Mockito) employs a verification strategy to ensure that calls get made. That is to say, you call your code as normal and then after you have finished the code being tested you can verify whether or not expected methods were called. This is very different from the aforementioned products for php which use an expectation strategy where you lay out your expectations prior to any calls being made.

Installation - Composer
-----------------------

[](#installation---composer)

Phake can be installed using [Composer](https://github.com/composer/composer).

```
composer require --dev phake/phake

```

Installation - Source
---------------------

[](#installation---source)

You can also of course install it from source by downloading it from our github repository:

Links
-----

[](#links)

There are a few links that have information on how you can utilize Phake.

- [Phake Website](https://phake.github.io)
- [Phake Documentation](https://phake.github.io/doc/)
- [Initial Phake Announcement](https://web.archive.org/web/20101230174850/http://digitalsandwich.com/archives/84-introducing-phake-mocking-framework.html)
- [PHPStorm Plugin](https://plugins.jetbrains.com/plugin/17261-phake)

If you have an article or tutorial that you would like to share, feel free to open an [issue](https://github.com/phake/phake/issues) on github and I will add it to this list

###  Health Score

73

—

ExcellentBetter than 100% of packages

Maintenance81

Actively maintained with recent releases

Popularity66

Solid adoption and visibility

Community54

Growing community involvement

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 50% 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 ~85 days

Total

60

Last Release

97d ago

Major Versions

v1.0.7 → v2.0.0-beta52015-01-27

v1.0.8 → v2.0.0-rc12015-02-23

v2.3.2 → v3.0.02017-07-04

2.1.x-dev → v4.0.02021-03-27

v3.1.9 → v4.2.0-RC12021-11-27

PHP version history (4 changes)v1.0.3PHP &gt;=5.2.0

v2.0.0-alpha1PHP &gt;=5.3.3

v3.0.0PHP &gt;=7

v4.0.0PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c73d11343c138758bb7d38713acf8f74c85998f2665cb0e7d73a8d13d3e7825?d=identicon)[bfeaver](/maintainers/bfeaver)

![](https://www.gravatar.com/avatar/35607eb323a445cbcb16f311282bedd405d3f839e498592e8c77e94b8f7cb1fd?d=identicon)[adoy](/maintainers/adoy)

![](https://www.gravatar.com/avatar/20fb815bd0dcec13ac0b92b2eaaacdecb34b43891bc9b7bcee3683b2a6a577fb?d=identicon)[mjlivelyjr](/maintainers/mjlivelyjr)

---

Top Contributors

[![mlively](https://avatars.githubusercontent.com/u/176150?v=4)](https://github.com/mlively "mlively (345 commits)")[![adoy](https://avatars.githubusercontent.com/u/80873?v=4)](https://github.com/adoy "adoy (160 commits)")[![bfeaver](https://avatars.githubusercontent.com/u/441396?v=4)](https://github.com/bfeaver "bfeaver (81 commits)")[![RickWong](https://avatars.githubusercontent.com/u/40102?v=4)](https://github.com/RickWong "RickWong (28 commits)")[![lifehackniki](https://avatars.githubusercontent.com/u/787955?v=4)](https://github.com/lifehackniki "lifehackniki (6 commits)")[![chocopie116](https://avatars.githubusercontent.com/u/787955?v=4)](https://github.com/chocopie116 "chocopie116 (6 commits)")[![niconoe-](https://avatars.githubusercontent.com/u/9560327?v=4)](https://github.com/niconoe- "niconoe- (6 commits)")[![marekkalnik](https://avatars.githubusercontent.com/u/548629?v=4)](https://github.com/marekkalnik "marekkalnik (5 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (5 commits)")[![elazar](https://avatars.githubusercontent.com/u/15487?v=4)](https://github.com/elazar "elazar (5 commits)")[![yuya-takeyama](https://avatars.githubusercontent.com/u/241542?v=4)](https://github.com/yuya-takeyama "yuya-takeyama (4 commits)")[![nicolasThal](https://avatars.githubusercontent.com/u/2675545?v=4)](https://github.com/nicolasThal "nicolasThal (4 commits)")[![jmalloc](https://avatars.githubusercontent.com/u/761536?v=4)](https://github.com/jmalloc "jmalloc (3 commits)")[![ngyuki](https://avatars.githubusercontent.com/u/1871654?v=4)](https://github.com/ngyuki "ngyuki (3 commits)")[![DennisBecker](https://avatars.githubusercontent.com/u/66930?v=4)](https://github.com/DennisBecker "DennisBecker (3 commits)")[![nijm](https://avatars.githubusercontent.com/u/6192260?v=4)](https://github.com/nijm "nijm (2 commits)")[![oochelz](https://avatars.githubusercontent.com/u/1957170?v=4)](https://github.com/oochelz "oochelz (2 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (2 commits)")[![iteman](https://avatars.githubusercontent.com/u/52985?v=4)](https://github.com/iteman "iteman (2 commits)")[![huggsboson](https://avatars.githubusercontent.com/u/3486668?v=4)](https://github.com/huggsboson "huggsboson (2 commits)")

---

Tags

frameworkmockphpphpunitspystubtest-doublestestingtestingmockstubspyphaketest-doubles

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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)[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)[kahlan/kahlan

The PHP Test Framework for Freedom, Truth and Justice.

1.2k1.2M247](/packages/kahlan-kahlan)[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)[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)
