Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Prophecy Phpunit Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Test Quality & Maintainability: Enables teams to write expressive, maintainable unit tests using Prophecy's API over PHPUnit's native mocks, reducing flakiness and improving test coverage for complex dependencies.
  • Build vs Buy Decision: Eliminates need for custom mocking solutions or manual integration work; leverages established, MIT-licensed package with active maintenance (PHPUnit 13 compatibility as of v2.5.0), making it a clear "buy" decision for Laravel projects.
  • Roadmap Alignment: Supports modern PHP 8.2+ and PHPUnit 10+ ecosystems, ensuring compatibility with upcoming Laravel versions while future-proofing test infrastructure.
  • Use Case Focus: Critical for teams building service-oriented architectures or complex domain models where precise mock behavior (e.g., argument constraints, dynamic return values) is essential for reliable test isolation.

When to Consider This Package

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

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4