phpspec/prophecy-phpunit
Integrates the Prophecy mocking library with PHPUnit for simpler, cleaner test doubles. Install via Composer and use the ProphecyTrait to call prophesize() inside your TestCase, set method predictions/returns, and reveal mocks for injection.
Adopt when using PHPUnit 9.1+ (where Prophecy isn’t natively integrated), PHP 8.2+, and needing more flexible mocking than PHPUnit’s built-in capabilities. Ideal for Laravel projects with dependency injection-heavy codebases where test clarity and precision matter. Look elsewhere if using PHPUnit <9.1 (which includes Prophecy natively), **non-PHP
How can I help you explore Laravel packages today?