PHP Mocking Framework
bfeaver Merge pull request #269 from mlively/fix-client-version-order
Check newer PHPUnit versions first
Latest commit 5208167 Aug 4, 2018
Failed to load latest commit information.
.travis Fixing the install script for hhvm Apr 26, 2015
src Check newer PHPUnit versions first Aug 4, 2018
tests Add support for PHPUnit 7.2 and Comparator 3 Jul 26, 2018
.codeclimate.yml Adding support for code climate Sep 3, 2015
.gitignore Merge commit '76fc7fd9d81d3b43cb65a099dfd2972270070e47' Jan 26, 2015
.scrutinizer.yml Setting up code coverage Apr 10, 2015
.travis.yml Attempt to exclude PHP 7 and PHPUnit 7.2 Jul 26, 2018
CHANGELOG.markdown Prepping next release. Also starting over on the change log sorta. May 9, 2015
LICENSE Committing copyright update and the packages.xml fixes Jan 1, 2012
README.markdown Update README.markdown May 9, 2015
composer.json Add support for PHPUnit 7.2 and Comparator 3 Jul 26, 2018
phpunit.xml.dist Use .dist phpunit.xml file. Ignore composer.phar. May 26, 2013



Documentation Status Build Status Latest Stable Version Total Downloads Latest Unstable Version License

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

Phake can be installed using Composer.

  1. Add Phake as a dependency.

You'll usually want this as a development dependency, so the example shows it in the require-dev section.

"require-dev": {
	"phake/phake": "2.*"
  1. Run Composer: php composer.phar install --dev or php composer.phar update phake/phake

Installation - Source

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


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

If you have an article or tutorial that you would like to share, feel free to open an issue on github and I will add it to this list