shipmonk/dead-code-detector
PHPStan extension that finds unused PHP code: dead methods, properties, constants, enum cases, cycles, and transitive “dead-tested” members. Supports popular frameworks like Symfony and can auto-remove dead code. Configurable detection and usage providers.
Codebase Health & Maintainability:
Developer Productivity:
removeDeadCode format).Framework-Specific Roadmaps:
Build vs. Buy:
Use Cases:
Adopt if:
Look elsewhere if:
eval(), create_function(), or magic methods like __call).*"This tool automates the cleanup of unused PHP code—like a 'git clean' for your logic. For every 10% of dead code removed, we reduce:
It integrates seamlessly with our existing PHPStan setup, requires no new infrastructure, and can be run in CI to block dead-code PRs. For Laravel/Symfony projects, it even understands framework-specific dead code (e.g., unused routes or Doctrine listeners). We can pilot it on [Module X] to measure impact before rolling out."*
*"This is a PHPStan extension that detects and removes dead code—methods, properties, constants, and even enum cases—with framework-specific awareness (Laravel routes, Symfony event listeners, Twig filters, etc.). Key benefits:
phpstan --error-format=removeDeadCode to auto-remove unused code.Setup:
composer.json: shipmonk/dead-code-detector.phpstan.neon:
includes:
- vendor/shipmonk/dead-code-detector/rules.neon
phpstan analyse to see dead code, or use --error-format=removeDeadCode to auto-clean.Example Output:
Unused UserFacade::updateUserAddress
🪪 Dead method (transitively unused: Address::setPostalCode, etc.)
Next Steps: Let’s run it on [Project Y] to validate false-positive rates before CI integration."*
Key Selling Points:
How can I help you explore Laravel packages today?