Skip to main content

CLI Reference

The complete reference for the prune command.

Synopsis

php vendor/bin/prune [paths...] [options]

Arguments

ArgumentDescription
pathsOne or more directories to scan. Optional and repeatable. Falls back to the config paths (default src) when omitted.
php vendor/bin/prune src
php vendor/bin/prune src app lib

Options

OptionShortcutValueDescription
--config-cpathPath to a config file. Overrides the default file resolution.
--format-fstringOutput format: console, json, or html. Overrides config.
--output-opathDestination file for json/html output. Overrides the default .prune/ location.
--bladeflagOnly scan Blade views; skips PHP class analysis.

Standard Symfony Console options also apply, including:

OptionDescription
-v, -vv, -vvvIncrease verbosity (e.g. prints the scanned file count).
--help, -hShow command help.
--version, -VShow the application version.
--no-ansiDisable colored output.

Precedence over the config file

When both a CLI value and a config value are present, the CLI wins:

SettingSource priority
Pathspaths argument → config paths → default src
Format--format → config format → default console
Blade--blade forces Blade-only mode; otherwise blade.enabled from config decides

Exit codes

CodeMeaning
0Success — no orphans found.
1Orphans found, or a fatal error (e.g. an invalid output path).

See CI Integration for how to use exit codes in a pipeline.

Examples

# Scan src/ and print a console table
php vendor/bin/prune src

# Scan multiple directories
php vendor/bin/prune src app lib

# Write a JSON report to a custom path
php vendor/bin/prune src --format=json --output=build/orphans.json

# Use a specific config file
php vendor/bin/prune --config=ci/prune.neon

# Only look for unused Blade views
php vendor/bin/prune resources/views --blade

# Verbose run showing the scanned file count
php vendor/bin/prune src -v