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
|
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| phpspec/prophecy-phpunit | 0.81 | 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. | 194 | 195 | 42 | 1M | 1 | 14.6 | 58.1 | MIT | 7 months ago | |
| mnapoli/phpunit-easymock | 0.80 | 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 | 2K | 0 | 4.8 | 22.3 | MIT | 1 year ago | |
| console-helpers/prophecy-phpunit | 0.79 | 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 | 91 | 0 | 15.5 | 30.7 | MIT | 4 months ago | |
| mockery/mockery | 0.79 | Mockery is a flexible PHP mock object framework for unit testing with PHPUnit, PHPSpec, and more. It provides a readable DSL to define expectations and interactions, integrates cleanly with PHPUnit, and can be used alongside PHPUnit’s own mocking tools. | 10,724 | 10,810 | 469 | 11M | 87 | 87.7 | 76.5 | BSD-3-Clause | 1 month ago | |
| jangregor/phpstan-prophecy | 0.77 | 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 | 7 months ago | |
| psalm/plugin-mockery | 0.74 | Adds Psalm static analysis support for the Mockery testing framework. Improves type inference and understanding of mocked objects and expectations in PHPUnit-style tests. Install via Composer and enable with psalm-plugin for better mock-related diagnostics. | 10 | 10 | 7 | 69K | 4 | 6.5 | 53.4 | MIT | 1 year ago | |
| docteurklein/test-double-bundle | 0.73 | Symfony bundle to simplify creating test doubles. Replace services automatically with stubs or fakes via DI container tags, improving test isolation and speed (e.g., Behat). Access original implementations with .real for infrastructure tests. | 40 | 40 | 11 | 288 | 2 | 1.4 | 12.5 | — | 10 years ago | |
| codeception/aspect-mock | 0.73 | — | 785 | 791 | 133 | 14K | 40 | 27.4 | 32.9 | MIT | 4 years ago | |
| phpstan/phpstan-mockery | 0.72 | PHPStan extension for Mockery: infers intersection types for mocks (Foo&MockInterface), understands shouldReceive/shouldHaveReceived/allows/expects, supports partial/alias/overload mocks, multiple interfaces, and proper constructor args for accurate static analysis. | 107 | 107 | 24 | 1M | 9 | 9.8 | 58.4 | MIT | 1 year ago | |
| php-mock/php-mock-mockery | 0.72 | 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 | 69K | 2 | 1.9 | 44.6 | WTFPL | 1 year ago | |
| mpyw/mockery-pdo | 0.72 | Experimental BDD-style PDO mocking library built on mockery/mockery. Define expectations for prepare/bind/execute and return rows via fetch/fetchAll in a fluent API, making PDO-based code easy to test on PHP 8.2+. | 3 | 3 | 2 | 731 | 1 | 7.9 | 33.1 | MIT | 8 months ago | |
| bentools/doctrine-static | 0.71 | Lightweight in-memory Doctrine mock for unit tests. Create ObjectManagers in a ManagerRegistry, persist/remove and flush to a temporary store, and use repository methods like find, findBy, findOneBy, and findAll. Not for real persistence. | 2 | 3 | 0 | 55 | 0 | 0.0 | 17.8 | — | — | |
| pestphp/pest-plugin | 0.68 | Plugin API for Pest PHP, the elegant testing framework. Use it to build and distribute Pest plugins that extend the runner, add custom expectations, hooks, and tooling integrations for your PHP test suite. | 48 | 49 | 14 | 4M | 0 | 1.0 | 55.6 | MIT | — | |
| aimeos/upscheme | 0.68 | Database migration and schema management for Laravel, using a simple, high-level PHP DSL. Create, modify, and version tables and indexes with up/down steps, auto rollbacks, and environment-aware execution. Works standalone or with Laravel apps. | 2,726 | 2,713 | 5 | 6K | 2 | 14.2 | 6.8 | LGPL-3.0 | — | |
| matthiasmullie/scrapbook | 0.67 | Scrapbook is a PHP caching library that wraps PSR-6/PSR-16 cache backends with adapters, multi-cache fallbacks, buffering and stampede protection. Use it to add fast, resilient caching with minimal code changes across files, memory or Redis stores. | 322 | 329 | 27 | 91K | 0 | 2.4 | 33.8 | MIT | — | |
| spatie/pest-expectations | 0.67 | Add expressive, chainable expectations to Pest tests with Spatie’s helpers. Provides handy assertion-style methods for cleaner, more readable tests, letting you validate values, types, strings, arrays, and more with minimal boilerplate. | 79 | 79 | 4 | 7K | 0 | 17.1 | 29.1 | MIT | 7 months ago | |
| weirdan/codeception-psalm-module | 0.67 | Codeception module that integrates Psalm static analysis into your test workflow. Run Psalm checks as part of Codeception suites to catch type issues and improve PHP code quality during CI and local testing. | 5 | 5 | 7 | 1K | 3 | 7.9 | 33.3 | MIT | 3 years ago |
How can I help you explore Laravel packages today?