Skip to main content

Output Formats

Prune can render its report in three formats: a console table (default), JSON, and HTML. Choose one with the --format option or the format config key.

php vendor/bin/prune src --format=console # default
php vendor/bin/prune src --format=json
php vendor/bin/prune src --format=html

Console

The default format prints a human-readable table directly to standard output. Use it for interactive runs and quick checks.

php vendor/bin/prune src

Pass -v (verbose) to also print how many files were scanned:

php vendor/bin/prune src -v
# Scanned 142 files.

JSON

JSON is the format to use when another tool consumes Prune's output.

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

The report has two top-level keys — classOrphans and bladeOrphans:

{
"classOrphans": [
{
"fqcn": "App\\Legacy\\OldPaymentGateway",
"file": "/path/to/project/src/Legacy/OldPaymentGateway.php",
"line": 12
}
],
"bladeOrphans": [
{
"viewName": "emails.legacy-receipt",
"file": "/path/to/project/resources/views/emails/legacy-receipt.blade.php"
}
]
}

HTML

HTML produces a self-contained, shareable report — handy for attaching to a code-review or a cleanup ticket.

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

Where reports are written

For json and html, Prune writes the report to a file rather than standard output:

  • By default it creates a .prune/ directory in your project and writes .prune/report.json or .prune/report.html.
  • Override the destination with --output:
php vendor/bin/prune src --format=json --output=build/orphans.json

:::note Path safety Prune refuses to write to a path whose parent directory does not exist, and it will not overwrite a symlink or any non-regular file. If the destination is invalid, the run fails with an error message. :::

The console format always prints to standard output and ignores --output.

See also