php-extended/placeholder-phpunit
A placeholder package for PHPUnit in php-extended projects. It provides minimal stubs so libraries can reference PHPUnit types without a hard dependency, keeping production installs lean while remaining compatible when PHPUnit is present.
TestCase, custom constraints, listeners, data-provider helpers, assertion traits — from a library's production source without putting phpunit/phpunit in our require block. It directly informs the require vs. require-dev split for any library we ship.Consider it when all of the following hold:
MockObject, a base class extending TestCase, or a factory typed against a PHPUnit interface.composer require our/package to stay dependency-light for the majority of consumers who never run tests.Look elsewhere when:
require-dev PHPUnit and be done.suggest + conflict entries in composer.json, or simply defining our own narrow interfaces and keeping PHPUnit at the boundary. These avoid the sync burden this package imposes on us.To executives: This is a small, low-cost packaging decision, not a roadmap item and not a customer-facing feature. It's about keeping our library's install footprint small so non-test users aren't forced to download PHPUnit. Cost is a few hours of engineering plus a recurring compatibility check; upside is a cleaner dependency story and fewer "why is PHPUnit in my production tree" complaints. Risk is contained because it affects only test-time code paths — but the project we'd depend on is unmaintained, so we should treat it as a pattern to adopt, not a vendor to trust.
To engineering: We can publish PHPUnit extension points without a hard production dependency on PHPUnit, and without forcing every consumer to install it. The tradeoff is that we own keeping the placeholder's signatures in sync with PHPUnit's real API — a mismatch is a fatal error at class declaration time, and a co-installed real PHPUnit can collide on autoload. Gate this behind a CI matrix across the PHPUnit majors we claim to support, pin the placeholder version exactly, and keep it out of anything on the critical path. If the sync burden proves annoying after one release cycle, the fallback is PHPStan stubs plus our own narrow interfaces.
How can I help you explore Laravel packages today?