# Prophecy

> Opinionated, flexible object mocking framework for PHP

Source: https://talira.ai/catalog/prophecy-fkqn9q8s
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), [languages / php](https://talira.ai/categories/languages/php)
- Licence: MIT[^1][^2]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [phpspec](https://talira.ai/orgs/phpspec-project.md)

Prophecy is a PHP object mocking framework, opinionated but flexible. It was first written for [phpspec](https://talira.ai/catalog/phpspec-k1mjredm.md) and works inside any test framework; the separate prophecy-phpunit package integrates it with [PHPUnit](https://talira.ai/catalog/phpunit-bg1qx6g0.md) 9.1 and later. You prophesize a class or interface and reveal a test double from it: dummies, stubs whose method prophecies return promised values for wildcarded arguments, mocks whose predictions are checked at the end of a test, and spies that record calls to check afterwards.

## Links

- GitHub: https://github.com/phpspec/prophecy

## Problems it solves

- mock a dependency in my PHPUnit test
- check a PHP method was called with the right arguments in a test
- stub an interface's return values in PHP tests

## Features

- dummies, stubs, mocks and spies from one prophecy API
- promises and argument wildcards on method prophecies
- predictions checked at the end of a test
- PHPUnit integration through prophecy-phpunit

## Trust

Overall: 0.43 out of 1.
Signals: maintenance 0.27, adoption 0.79, momentum 0.52, community 0.85, backing 0.30, extensibility 0.00.

- latest release v1.26.0 9 months ago
- 8.5k GitHub stars
- 136 contributors
- backed by phpspec

Warnings:

- last commit 7 months ago

## Related

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

## Alternatives

- [Mockery](https://talira.ai/catalog/mockery-1wmr5g8e.md): Mock object framework for PHP unit tests
- [Phake](https://talira.ai/catalog/phake-5m4p0z8t.md): A PHP mocking framework that verifies calls after the fact, like Mockito.

## Sources

[^1]: https://github.com/phpspec/prophecy/blob/master/LICENSE (checked 28 Nov 2026)
[^2]: https://github.com/phpspec/prophecy/blob/master/composer.json (checked 28 Nov 2026)
