phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 23 minutes ago
Added to GitGenius on September 7th, 2026
Created on March 25th, 2013
Open Issues & Pull Requests: 103 (+0)
GitHub issues: Enabled
Number of forks: 247
Total Stargazers: 8,468 (+0)
Total Subscribers: 29 (+0)

Repository Insights (GitGenius)

Most active contributors

Sign in to see contributor activity.

Related repositories by overlapping contributors

No overlapping-contributor repos identified yet.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 8
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 1,291 days
Stale 30+ days: 8
Stale 90+ days: 7

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • PHP8.2 (2)
  • PHP8.1 (1)
  • PHP8.4 (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

Prophecy is a mocking framework for PHP that provides a highly opinionated approach to creating test doubles with a fluent, semantically meaningful API.

The framework addresses the need for flexible object mocking in unit tests by using a "prophecy" metaphor where developers describe expected future behavior of objects with limited prior knowledge. The core workflow involves creating an ObjectProphecy through a Prophet object, specifying what class the mock should extend or interfaces it should implement, then revealing the prophecy as a usable test double. The framework distinguishes between dummies (objects that do nothing and return null for all method calls), stubs (dummies with method-specific behavior logic), and mocks (objects with explicit expectations about how they will be called).

Prophecy suits developers working within any PHP testing framework who want a semantically clear mocking API where terminology carries logical meaning. The framework was originally created to serve phpspec2 but is flexible enough for standalone use. It works well when you need token objects to satisfy type hints without caring about behavior, when you want stubs with specific return values for different method signatures, or when you need mocks with strict expectations about method invocations. The README emphasizes that understanding the semantic naming convention—where "prophecy" describes future behavior, "prophet" creates prophecies, and "revealing" produces usable doubles—is key to becoming fluent with the tool.

The project maintains active engagement with its codebase through regular commits addressing both bug fixes and feature refinements. Pull requests receive timely review and feedback from maintainers, indicating responsive stewardship. The issue tracker shows consistent attention to user-reported problems and feature requests, with maintainers providing detailed explanations and guidance. Documentation is kept current alongside code changes, and the project demonstrates a commitment to supporting multiple PHP versions through ongoing compatibility work.