Scroll to navigation

PHPMD(1) User Commands PHPMD(1)

NAME

PHPMD - PHPMD command line interface

DESCRIPTION

Mandatory arguments: 1) A php source code filename or directory. Can be a comma-separated string, glob pattern, or "-" to scan stdin 2) A report format 3) A ruleset filename or a comma-separated string of rulesetfilenames

Example: phpmd /path/to/source format ruleset

Available formats: ansi, baseline, checkstyle, github, gitlab, html, json, sarif, text, xml. Available rulesets: cleancode, codesize, controversial, design, naming, unusedcode.

Optional arguments that may be put after the mandatory arguments: --verbose, -v, -vv, -vvv: Show debug information. --minimum-priority: rule priority threshold; rules with lower priority than this will not be used --report-file: send report output to a file; default to STDOUT --error-file: send errors (other than reported violations) output to a file; default to STDERR --suffixes: comma-separated string of valid source code filename extensions, e.g. php,phtml --exclude: comma-separated string of patterns that are used to ignore directories. Use asterisks to exclude by pattern. For example *src/foo/*.php or *src/foo/* --strict: also report those nodes with a @SuppressWarnings annotation --ignore-errors-on-exit: will exit with a zero code, even on error --ignore-violations-on-exit: will exit with a zero code, even if any violations are found --cache: will enable the result cache. --cache-file: instead of the default .phpmd.result-cache.php will use this file as result cache file path. --cache-strategy: sets the caching strategy to determine if a file is still fresh. Either `content` to base it on the file contents, or `timestamp` to base it on the file modified timestamp --generate-baseline: will generate a phpmd.baseline.xml next to the first ruleset file location --update-baseline: will remove any non-existing violations from the phpmd.baseline.xml --baseline-file: a custom location of the baseline file --color: enable color in output --extra-line-in-excerpt: Specify how many extra lines are added to a code snippet in html format --: Explicit argument separator: Anything after "--" will be read as an argument even ifit starts with "-" or matches the name of an option

March 2024 PHPMD 2.15.0