nunomaduro/mock-final-classes
Dev-only helper that automatically enables mocking of final classes and methods in PHP tests. Works with PHPUnit, Pest, and ParaTest by removing final keywords on the fly via dg/bypass-finals—install with Composer and it just works.
Architecture fit: Strong alignment with Laravel's testing ecosystem. Laravel projects commonly integrate third-party SDKs (e.g., AWS, Stripe) with final classes, and this package directly addresses testing challenges without modifying production code. It leverages PHPUnit's existing workflow, which is standard in Laravel applications.
Integration feasibility: High. Simple Composer installation (composer require --dev nunomaduro/mock-final-classes) with no additional bootstrapping required. However, the absence of a public repository complicates version compatibility checks and issue tracking.
Technical risk: Moderate. Bypassing final restrictions typically relies on PHP reflection or runtime hacks, which could break with PHP updates (
How can I help you explore Laravel packages today?