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

Bypass Finals Laravel Package

dg/bypass-finals

DG\BypassFinals lets you bypass PHP’s final classes and methods at runtime so you can mock, extend, or patch code that’s otherwise locked down—useful for testing legacy dependencies. Lightweight, Composer-ready, and works with popular test frameworks.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit: The package aligns with Laravel's dependency injection patterns by enabling mocking of final vendor classes (e.g., third-party SDKs or legacy code), which is otherwise impossible. However, Laravel's core architecture avoids final where possible, so utility is limited to edge cases involving external dependencies. Integration feasibility: Requires Composer installation and bootstrap configuration (e.g., phpunit.xml or test bootstrap file). Works with PHPUnit/Mockery out-of-the-box but requires careful scoping to avoid production exposure. Technical risk: High due to NOASSERTION license (legal uncertainty), potential for false-positive tests (bypassed final behavior may differ from production), and PHP 8+ readonly compatibility risks. Key questions: How does it interact with OPcache? Is it compatible with Laravel's service container? What's the maintenance status given the unknown repository? Does it support PHP 8.2+ features?

Integration Approach

Stack fit: Fully compatible with Laravel's testing stack (PHPUnit, Pest, Mockery) but requires explicit isolation to test environments only. Must avoid loading in production via environment checks. Migration path: Add to composer.json as dev dependency, then modify bootstrap/test.php or phpunit.xml to initialize the bypass before tests. Minimal code changes needed for existing tests targeting final classes. Compatibility: Works with Laravel 8+ and PHP 7.4+, but verify compatibility with PHP 8.2+ readonly semantics. Sequencing: Install → configure test bootstrap → run tests → ensure no production deployment includes the package (via CI checks or environment flags).

Operational Impact

Maintenance: High risk due to unknown repository and NOASSERTION license; no clear support channels or version history. May break with PHP updates. Support: Limited community support (stars alone don't indicate active maintenance); debugging requires deep package knowledge. Scaling: Negligible performance impact in CI (single-pass bytecode manipulation), but large test suites may see ~5-10% slowdown. Failure modes: Accidental production use could cause runtime errors (e.g., final removal breaking type safety); false test passes if bypass logic conflicts with actual class behavior. Ramp-up: Requires team training on strictly test-only usage, documentation of "when to use" guidelines, and CI safeguards (e.g., fail builds if package is loaded outside testing environment).

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