# Phake

> A PHP mocking framework that verifies calls after the fact, like Mockito.

Source: https://talira.ai/catalog/phake-5m4p0z8t
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [developer tools / testing / mocking](https://talira.ai/categories/developer-tools/testing/mocking)
- Licence: Phake BSD 3-clause licence[^2][^3]
- Pricing: Free[^1]
- Free tier: yes[^1]
- Backed by: [Mike Lively](https://talira.ai/orgs/mike-lively.md)

Phake is a PHP framework for mock objects, test doubles and method stubs. Inspired by Java's Mockito, it uses a verification strategy: you run the code under test as normal and then verify which methods were called, rather than laying out expectations beforehand as [PHPUnit](https://talira.ai/catalog/phpunit-bg1qx6g0.md)'s built-in mocks do.

## Links

- Website: https://phake.github.io/
- GitHub: https://github.com/phake/phake
- Docs: https://phake.github.io/

## Problems it solves

- mock a class in my PHP tests and check afterwards which methods were called
- stub a dependency's return value in a PHP unit test
- a Mockito-style mocking library for PHP

## Features

- mock objects, test doubles and method stubs
- verify calls after running the code (Mockito-style)
- mocking static methods
- parameter matchers and answers

## Trust

Overall: 0.33 out of 1.
Signals: maintenance 0.27, adoption 0.54, momentum 0.16, community 0.71, backing 0.30, extensibility 0.00.

- latest release v4.7.0 9 months ago
- 478 GitHub stars
- 60 contributors
- backed by Mike Lively

Warnings:

- last commit 9 months ago

## Related

- Works with [PHPUnit](https://talira.ai/catalog/phpunit-bg1qx6g0.md)

## Alternatives

- [Mockery](https://talira.ai/catalog/mockery-1wmr5g8e.md): Mock object framework for PHP unit tests
- [Prophecy](https://talira.ai/catalog/prophecy-fkqn9q8s.md): Opinionated, flexible object mocking framework for PHP

## Sources

[^1]: https://github.com/phake/phake/blob/master/README.markdown (checked 29 Nov 2026)
[^2]: https://github.com/phake/phake/blob/master/LICENSE (checked 29 Nov 2026)
[^3]: https://github.com/phake/phake/blob/master/composer.json (checked 29 Nov 2026)
