Skip to main content

Quick Start

This guide takes you from a fresh install to your first orphan report in a couple of minutes.

1. Scan a directory

Point Prune at the directory you want to analyze:

php vendor/bin/prune src

You can pass several directories at once:

php vendor/bin/prune src app lib

If you don't pass any path, Prune falls back to the paths defined in your config file (default: src).

2. Read the report

By default Prune prints a console table listing every class it believes is orphaned, along with the file and line where it is declared:

----------------------------- ------------------------- ------
Orphaned Class File Line
----------------------------- ------------------------- ------
App\Legacy\OldPaymentGateway src/Legacy/OldPayment... 12
----------------------------- ------------------------- ------

If nothing is orphaned, Prune tells you the codebase is clean.

3. Understand the exit code

Prune exits with:

  • 0 — no orphans found (clean).
  • 1 — at least one orphan was found.

This makes it usable as a gate in scripts and pipelines. See CI Integration.

4. Try other output formats

Switch to a machine-readable or shareable format:

php vendor/bin/prune src --format=json
php vendor/bin/prune src --format=html

JSON and HTML reports are written to .prune/report.json or .prune/report.html in your project. See Output Formats for details.

5. Investigate before deleting

warning

A class appearing in the report does not guarantee it is safe to delete. Prune performs static analysis only and cannot see runtime/dynamic references. Always review each entry — read Limitations & Risks first.

Where to go next