Automatic dead code and route scanner for Laravel applications.
composer require zalanihir/deadcode-scanner --devLaravel auto-discovers the service provider via extra.laravel.providers.
Optionally publish the config:
php artisan vendor:publish --tag=deadcode-configphp artisan deadcode:scanOptions:
--detailsShow counts and extra info--jsonOutput JSON report to stdout
- Routes pointing to missing controllers/methods
- Unused public controller methods under
app/Http/Controllers - Unused Blade views (
resources/views) - Undefined routes referenced in Blade via
route('name')
After publishing the config (config/deadcode.php):
return [
'ignore' => [
'routes' => [
// route names or URIs
'login',
'healthz',
],
'controllers' => [
// fully-qualified controller classes
App\Http\Controllers\Internal\WebhookController::class,
],
'controller_methods' => [
// method names or FQCN::method
'helper',
App\Http\Controllers\UserController::class . '::legacy',
],
'views' => [
// dot-notation view names
'errors::404',
'emails.welcome',
],
],
];- Heuristics are conservative; review before deleting code.
- Scans only literal references (no runtime/generated view names).