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

Mock Final Classes Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enables testing of code dependent on third-party SDKs with final classes without modifying vendor code
  • Reduces technical debt by eliminating unnecessary production code refactoring solely for testability
  • Supports a "buy vs build" decision where adopting this lightweight package is faster and safer than custom mocking solutions
  • Critical for projects using sealed dependencies (e.g., legacy systems or closed-source APIs) where interfaces can't be implemented
  • Aligns with test-driven development (TDD) by allowing true unit test isolation for otherwise untestable dependencies

When to Consider This Package

  • ✅ Adopt when:
    • Testing code that relies on third-party libraries with final classes (e.g., AWS SDK, Stripe, or other vendor SDKs)
    • Using PHPUnit for testing and needing minimal setup to mock sealed dependencies
    • Refactoring production code is impossible (e.g., due to vendor lock-in or compliance constraints)
  • ❌ Avoid when:
    • Your codebase has no final class dependencies or uses interfaces for testability
    • The project uses non-PHPUnit testing frameworks (e.g., Pest without PHPUnit compatibility)
    • You can redesign dependencies to remove final modifiers (e.g., for internal code)

How to Pitch It (St

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
milesj/emojibase
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