New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

edalzell/dead-code-detector-laravel

PHPStan extensions teaching shipmonk/dead-code-detector about Eloquent trait hooks and #[Scope] attributes
2,313

Larablocks Analysis

edalzell/dead-code-detector-laravel works with any PHP project: the latest release (v0.0.1, Sep 9, 2026) doesn't depend on Laravel.

Recommendation checks

Use with care

Use with care: meets 1 of 4 checks.

  • Released in the last 12 months (Sep 9, 2026)
  • First released under 90 days ago
  • 1,831 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Too new to judge
  • Last stable release: Sep 9, 2026.
  • 1 release in the last 12 months.
  • First released: Sep 9, 2026.
  • Monthly downloads: 1,831.
  • 2 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.

Install
composer require edalzell/dead-code-detector-laravel
Latest Version:v0.0.1
PHP:^8.2
License:MIT
Last Updated:Nov 4, 2026
Links: GitHub  ·  Packagist
Maintainer: edalzell

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Two usage providers for shipmonk/dead-code-detector, covering Laravel conventions its own providers do not: Eloquent trait hooks and #[Scope] attributes.

This is a PHPStan extension, not a Laravel package. There is no service provider and nothing to publish.

For lorisleiva/laravel-actions, see edalzell/dead-code-detector-laravel-actions.

Installation

composer require --dev edalzell/dead-code-detector-laravel

With phpstan/extension-installer the extension registers itself. Without it, add one line:

includes:
    - vendor/shipmonk/dead-code-detector/rules.neon
    - vendor/edalzell/dead-code-detector-laravel/extension.neon

What each extension does

EloquentTraitHooksUsageProvider — Eloquent invokes a trait's boot{Trait} and initialize{Trait} hooks reflectively. Shipmonk's Eloquent provider knows only Model::boot and Model::booted, so every hook a trait declares reads as dead.

EloquentScopeAttributeUsageProvider — a #[Scope] method is reached through the query builder, never called by name. Shipmonk's Eloquent provider recognises the older scopeName() convention only, so an attribute-declared scope reads as dead however many callers it has.

Testing

composer test

The suite runs PHPStan over tests/Fixtures three times: once with the shipped extension.neon, and once per extension with that one service left out. Each run asserts the exact set of members reported dead, so removing any extension turns a test red with a named fixture rather than quietly changing nothing.

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.

Alternatives to edalzell/dead-code-detector-laravel

larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan exte...

100,439,351 6,560
shipmonk/dead-code-detector

Dead code detector to find unused PHP code via PHPStan extension. Can automatica...

8,468,318 539
calebdw/larastan-livewire

A Larastan / PHPStan extension for Livewire.

1,275,457 66
hosmelq/php-coding-standard

Opinionated ECS, Rector, and PHPStan presets for PHP and Laravel packages and ap...

2,606 1

Version History

Version Released PHP License
v0.0.1 ^8.2 MIT