phpspec/prophecy
Highly opinionated yet flexible PHP mocking framework for unit tests. Create test doubles with a Prophet, define expected calls and return values, then reveal mocks and verify predictions. Works with PHPUnit and other frameworks; requires PHP 7.2+.
|
Package
|
Score
|
Description
|
Stars
|
Likes
|
Forks
|
Downloads
|
Issues
|
Score
|
Opportunity
|
License
|
Last Release
|
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| php-mock/php-mock-integration | 0.88 | Integration layer for php-mock, making it easy to use PHP function mocks within popular test frameworks. Helps you stub built-in functions like time(), rand(), and file operations in specific namespaces, enabling reliable, isolated unit tests without touching global state. | 14 | 14 | 6 | 374K | 0 | 8.2 | 57.8 | WTFPL | 9 months ago | |
| php-mock/php-mock-prophecy | 0.88 | Prophecy integration for php-mock lets you mock PHP built-in functions like time, rand, and sleep inside Prophecy test doubles. Define expected behavior for global functions alongside class mocks, making time-dependent code testable without hard dependencies. | 16 | — | 4 | — | 0 | 1.1 | — | WTFPL | 11 months ago |
|
| php-mock/php-mock-phpunit | 0.88 | Integrate php-mock with PHPUnit to mock built-in PHP functions (like time(), file_get_contents(), etc.) in a controlled, namespaced way. Ideal for unit tests that need to simulate IO, time, and other global behaviors without changing production code. | 173 | 176 | 20 | 236K | 4 | 28.3 | 51.3 | WTFPL | 1 month ago | |
| phpspec/prophecy-phpunit | 0.87 | 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. | 195 | 195 | 39 | 1M | 1 | 11.7 | 56.7 | MIT | 8 months ago | |
| php-mock/php-mock | 0.87 | Mock built-in PHP functions like time() or rand() in tests by leveraging PHP’s namespace fallback: define namespaced replacements for unqualified calls. Works in non-global namespaces; supports common test frameworks via integrations (e.g., PHPUnit). | 370 | 375 | 19 | 726K | 3 | 13.0 | 47.8 | WTFPL | 9 months ago | |
| phperf/phpunit | 0.87 | phperf/phpunit is a lightweight PHPUnit extension aimed at profiling and performance measurement during test runs. Add simple hooks to capture timing and resource usage so you can spot slow tests and track performance regressions over time. | 0 | 0 | 0 | 193 | 0 | 0.9 | 31.2 | NOASSERTION | 4 years ago | |
| php-http/mock-client | 0.87 | Mock HTTP client for HTTPlug/PHP-HTTP. Stores outgoing requests and returns queued responses or throws exceptions instead of making real network calls—ideal for unit tests of HTTP-dependent code. Install via Composer as a dev dependency. | 71 | 75 | 16 | 266K | 0 | 6.0 | 49.3 | MIT | 2 years ago | |
| phake/phake | 0.86 | Phake is a PHP mocking framework for PHPUnit and other test runners. Create mocks, stubs, and spies with a simple API, verify method calls and arguments, and define return values or exceptions—ideal for fast, isolated unit tests. | 478 | 486 | 86 | 66K | 13 | 23.7 | 37.2 | NOASSERTION | 8 months ago | |
| phpunit/phpunit-mock-objects | 0.86 | Default mock object library for PHPUnit. Create test doubles (mocks, stubs, spies) to isolate units under test, define expectations, control method returns, and verify interactions. Designed for PHPUnit projects and compatible with PHP 7.1+. | 4,919 | 5,056 | 151 | 759K | 0 | 15.2 | 21.4 | NOASSERTION | 13 years ago | |
| phpspec/phpspec2 | 0.86 | — | 162 | 169 | 25 | 32 | 0 | 0.9 | 1.0 | NOASSERTION | — | |
| fidry/php-cs-fixer-config | 0.86 | Personal base PHP-CS-Fixer configuration by Théo Fidry. Install as a dev dependency, then use FidryConfig in php-cs-fixer.dist.php with your Finder, a header comment, and minimum supported PHP version. Extend or override rules as needed. | 6 | 6 | 1 | 2K | 0 | 7.5 | 35.8 | MIT | 9 months ago | |
| console-helpers/prophecy-phpunit | 0.86 | PHPUnit integration helpers for Prophecy, providing convenience traits and utilities to streamline mock creation, prophecy assertions, and cleanup in your test suite. Designed to reduce boilerplate and keep Prophecy-based unit tests tidy and consistent. | 0 | 0 | 1 | 51 | 0 | 12.1 | 26.1 | MIT | 5 months ago | |
| unleashedtech/php-coding-standard | 0.86 | Opinionated PHP coding standard by Unleashed Tech, built on PHP-CS-Fixer rules and presets to keep code style consistent across projects. Easy to install via Composer and integrate into CI for automated linting and formatting. | 1 | 1 | 3 | 4K | 5 | 1.5 | 46.1 | NOASSERTION | 1 year ago | |
| eloquent/phony | 0.86 | — | 193 | 196 | 7 | 2K | 8 | 6.2 | 11.7 | MIT | 5 years ago | |
| weirdan/prophecy-shim | 0.86 | Lightweight shim around Prophecy for PHPUnit, helping keep legacy Prophecy-based tests running on newer PHPUnit/Laravel stacks. Provides compatibility glue with minimal changes so you can upgrade tooling without rewriting your mocks. | 1 | 1 | 0 | 3K | 0 | 1.5 | 43.6 | — | 6 years ago | |
| janmarek/mockista | 0.86 | Mockista is a lightweight mocking library for PHP/Laravel that helps you create and configure test doubles quickly. Define expectations, stub methods, and verify calls with a simple, fluent API to keep unit tests fast, readable, and maintainable. | 29 | 29 | 14 | 248 | 2 | 1.4 | 14.9 | — | — | |
| php-mock/php-mock-mockery | 0.85 | Integrates php-mock with Mockery to mock PHP built-in functions in tests. Create namespaced function mocks with PHPMockery::mock() and set expectations/returns, then call Mockery::close(). Supports only unqualified calls; define early if needed. | 39 | 39 | 5 | 78K | 2 | 1.9 | 45.4 | WTFPL | 1 year ago | |
| phpstan/phpstan-phpunit | 0.85 | PHPStan extension for PHPUnit that improves mock object and assert type inference, supports MockBuilder and phpDoc intersections, and adds optional strict rules for more precise, framework-aware static analysis. | 547 | 550 | 58 | 6M | 34 | 43.9 | 79.1 | MIT | 1 month ago | |
| mnapoli/phpunit-easymock | 0.85 | A lightweight bridge between PHPUnit and EasyMock for PHP. Quickly create, replay, and verify mocks from your test cases with minimal boilerplate, helping you write clear unit tests using the familiar EasyMock-style workflow. | 38 | 38 | 4 | 1K | 0 | 4.8 | 20.6 | MIT | 1 year ago | |
| jangregor/phpstan-prophecy | 0.85 | PHPStan extension for phpspec/prophecy that improves type inference in tests. It teaches PHPStan the real types returned from Prophecy workflows like prophesize(), willExtend(), and reveal(), so your revealed doubles are understood as the mocked class. | 111 | 111 | 30 | 414K | 3 | 18.6 | 53.5 | MIT | 8 months ago |
How can I help you explore Laravel packages today?