Skip to main content

Prune

Prune (renfordt/prune) is a command-line tool that finds orphaned and unused PHP classes in your project through static AST analysis.

It parses your PHP files with nikic/php-parser, collects every class declaration and every class reference, and then reports the classes that are declared but never referenced anywhere in the scanned codebase. It can additionally detect unused Blade views in Laravel projects.

caution

Work in progress - Prune is still heavily under development and should not be relied on in production. Always review its output before deleting anything — see Limitations & Risks.

What Prune does

  • Scans one or more directories for PHP files.
  • Builds a map of all declared classes, interfaces, traits, and enums.
  • Collects every reference to those types (extends, new, type hints, attributes, docblocks, and more).
  • Reports any declaration that is never referenced — an orphan.
  • Optionally detects unused Blade views in Laravel projects.
  • Outputs to a console table, JSON, or HTML.
  • Returns a non-zero exit code when orphans are found, so it slots cleanly into CI.

Who it's for

Prune is built for developers and teams who want to keep a PHP codebase lean — spotting dead classes after a refactor, during a cleanup sprint, or as a recurring check in continuous integration.

Where to go next

If you want to…Read
Install and run Prune for the first timeInstallationQuick Start
Switch between console, JSON, and HTMLOutput Formats
Find unused Blade viewsBlade Analysis
Fail your pipeline on dead codeCI Integration
Tune what gets scannedConfiguration File · CLI Reference
Understand the analysis internalsHow It Works
Know what Prune can't seeLimitations & Risks

Requirements

License

Prune is released under the MIT License.