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

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

ngyuki/phake
============

The Phake mock testing library

v1.0.3-p2(13y ago)09081BSDXMLPHP &gt;=5.2.0

Since May 14Pushed 13y agoCompare

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

READMEChangelogDependenciesVersions (6)Used By (1)

Phake
=====

[](#phake)

[![Build Status](https://camo.githubusercontent.com/06cfa1c5ee12b517df1b8ec9cfbc125838a7691d796850f06e8f75ab9787845f/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6d6c6976656c792f5068616b652e706e67)](http://travis-ci.org/mlively/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).

1. Add Phake as a dependency.

```
"require": {
	"phake/phake": "dev-master"
}
```

2. Run Composer: `php composer.phar install` or `php composer.phar update`

Installation - PEAR
-------------------

[](#installation---pear)

Phake can be installed using PEAR via the Digital Sandwich PEAR channel

This pear channel can be added to PEAR with the following command:

```
pear channel-discover pear.digitalsandwich.com

```

You should only need to do that once. After this you can install Phake with the following command

```
pear install digitalsandwich/Phake

```

After the installation you can find the Phake source files inside your local PEAR directory

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 Documentation](http://phake.digitalsandwich.com/docs/html/)
- [Phake Google Group](http://groups.google.com/group/phake-users)
- [Initial Phake Announcement](http://digitalsandwich.com/archives/84-introducing-phake-mocking-framework.html)

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

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 79.1% 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 ~113 days

Total

3

Last Release

4890d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/59c1a249461372e49b321fd58caa31e68cfa87cee38d3bb572a9993afaa99cab?d=identicon)[ngyuki](/maintainers/ngyuki)

---

Top Contributors

[![mlively](https://avatars.githubusercontent.com/u/176150?v=4)](https://github.com/mlively "mlively (167 commits)")[![bfeaver](https://avatars.githubusercontent.com/u/441396?v=4)](https://github.com/bfeaver "bfeaver (20 commits)")[![ngyuki](https://avatars.githubusercontent.com/u/1871654?v=4)](https://github.com/ngyuki "ngyuki (8 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (5 commits)")[![yuya-takeyama](https://avatars.githubusercontent.com/u/241542?v=4)](https://github.com/yuya-takeyama "yuya-takeyama (4 commits)")[![marekkalnik](https://avatars.githubusercontent.com/u/548629?v=4)](https://github.com/marekkalnik "marekkalnik (2 commits)")[![iteman](https://avatars.githubusercontent.com/u/52985?v=4)](https://github.com/iteman "iteman (2 commits)")[![sebastianbergmann](https://avatars.githubusercontent.com/u/25218?v=4)](https://github.com/sebastianbergmann "sebastianbergmann (2 commits)")[![Dynom](https://avatars.githubusercontent.com/u/39014?v=4)](https://github.com/Dynom "Dynom (1 commits)")

---

Tags

testingmock

### Embed Badge

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

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

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

The Phake mock testing library

4758.0M324](/packages/phake-phake)[kahlan/kahlan

The PHP Test Framework for Freedom, Truth and Justice.

1.2k1.2M247](/packages/kahlan-kahlan)[brain/monkey

Mocking utility for PHP functions and WordPress plugin API

33812.5M350](/packages/brain-monkey)[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)
