PHPackages                             xsolve-pl/phpmd - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. xsolve-pl/phpmd

ActiveLibrary

xsolve-pl/phpmd
===============

Official version of PHPMD handled with Composer.

1.4.0(13y ago)111.7k↑552.2%PHPPHP &gt;=5.3.0

Since Sep 7Pushed 13y ago2 watchersCompare

[ Source](https://github.com/xsolve-pl/phpmd)[ Packagist](https://packagist.org/packages/xsolve-pl/phpmd)[ RSS](/packages/xsolve-pl-phpmd/feed)WikiDiscussions master-xsolve Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Command line usage
==================

[](#command-line-usage)

Type phpmd \[filename|directory\] \[report format\] \[ruleset file\], i.e:

```
mapi@arwen ~ $ phpmd PHP/Depend/DbusUI/ xml rulesets/codesize.xml

      This class has too many methods, consider refactoring it.

```

You can pass a file name or a directory name containing PHP source code to PHPMD.

The PHPMD PEAR or Phar distribution includes the rule set files inside its archive, even if the "rulesets/codesize.xml" parameter above looks like a filesystem reference.

Command line options
--------------------

[](#command-line-options)

- Notice that the default output is in XML, so you can redirect it to a file and XSLT it or whatever
- You can also use shortened names to refer to the built-in rule sets, like this:

    ```
    phpmd PHP/Depend/DbusUI/ xml codesize
    ```
- The command line interface also accepts the following optional arguments:

    - `--minimumpriority` - The rule priority threshold; rules with lower priority than they will not be used.
    - `--reportfile` - Sends the report output to the specified file, instead of the default output target `STDOUT`.
    - `--suffixes` - Comma-separated string of valid source code filename extensions.
    - `--exclude` - Comma-separated string of patterns that are used to ignore directories.
    - `--struct` - Also report those nodes with a @SuppressWarnings annotation.

### Using multiple rule sets

[](#using-multiple-rule-sets)

PHPMD uses so called rule sets that configure/define a set of rules which will be applied against the source under test. The default distribution of PHPMD is already shipped with a few default sets, that can be used out-of-box. You can call PHPMD's cli tool with a set's name to apply this configuration:

```
~ $ phpmd /path/to/source text codesize
```

But what if you would like to apply more than one rule set against your source? You can also pass a list of rule set names, separated by comma to PHPMD's cli tool:

```
~ $ phpmd /path/to/source text codesize,unusedcode,naming
```

You can also mix custom [rule set files](/documentation/creating-a-ruleset.html) with build-in rule sets:

```
~ $ phpmd /path/to/source text codesize,/my/rules.xml
```

That's it. With this behavior you can specify you own combination of rule sets that will check the source code.

### Using multiple source files and folders

[](#using-multiple-source-files-and-folders)

PHPMD also allowes you to specify multiple source directories in case you want to create one output for certain parts of your code

```
~ $ phpmd /path/to/code,index.php,/another/place/with/code text codesize
```

Exit codes
----------

[](#exit-codes)

PHPMD's command line tool currently defines three different exit codes.

- 0, This exit code indicates that everything worked as expected. This means there was no error/exception and PHPMD hasn't detected any rule violation in the code under test.
- *1*, This exit code indicates that an error/exception occured which has interrupted PHPMD during execution.
- *2*, This exit code means that PHPMD has processed the code under test without the occurence of an error/exception, but it has detected rule violations in the analyzed source code.

Renderers
---------

[](#renderers)

At the moment PHPMD comes with the following three renderers:

- *xml*, which formats the report as XML.
- *text*, simple textual format.
- *html*, single HTML file with possible problems.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4992d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/09183c33618505e4ae21c86f3d4ffce6eaf2417fc15896c1f8db6b3c62be064f?d=identicon)[mariusz-bak-xsolve-pl](/maintainers/mariusz-bak-xsolve-pl)

---

Top Contributors

[![manuelpichler](https://avatars.githubusercontent.com/u/58714?v=4)](https://github.com/manuelpichler "manuelpichler (586 commits)")[![zerkalica](https://avatars.githubusercontent.com/u/274786?v=4)](https://github.com/zerkalica "zerkalica (6 commits)")[![sebastianbergmann](https://avatars.githubusercontent.com/u/25218?v=4)](https://github.com/sebastianbergmann "sebastianbergmann (4 commits)")[![timmartin](https://avatars.githubusercontent.com/u/56920?v=4)](https://github.com/timmartin "timmartin (4 commits)")[![gennadiylitvinyuk](https://avatars.githubusercontent.com/u/674894?v=4)](https://github.com/gennadiylitvinyuk "gennadiylitvinyuk (3 commits)")[![mariusz-bak-xsolve-pl](https://avatars.githubusercontent.com/u/1810317?v=4)](https://github.com/mariusz-bak-xsolve-pl "mariusz-bak-xsolve-pl (3 commits)")[![francisbesset](https://avatars.githubusercontent.com/u/471525?v=4)](https://github.com/francisbesset "francisbesset (3 commits)")[![edorian](https://avatars.githubusercontent.com/u/247397?v=4)](https://github.com/edorian "edorian (2 commits)")[![zstakacs](https://avatars.githubusercontent.com/u/770271?v=4)](https://github.com/zstakacs "zstakacs (1 commits)")[![palbertini](https://avatars.githubusercontent.com/u/2226651?v=4)](https://github.com/palbertini "palbertini (1 commits)")[![rouffj](https://avatars.githubusercontent.com/u/24047?v=4)](https://github.com/rouffj "rouffj (1 commits)")[![willemstuursma](https://avatars.githubusercontent.com/u/701299?v=4)](https://github.com/willemstuursma "willemstuursma (1 commits)")[![wowo](https://avatars.githubusercontent.com/u/100724?v=4)](https://github.com/wowo "wowo (1 commits)")[![chehodgins](https://avatars.githubusercontent.com/u/61745?v=4)](https://github.com/chehodgins "chehodgins (1 commits)")

### Embed Badge

![Health badge](/badges/xsolve-pl-phpmd/health.svg)

```
[![Health](https://phpackages.com/badges/xsolve-pl-phpmd/health.svg)](https://phpackages.com/packages/xsolve-pl-phpmd)
```

###  Alternatives

[phpmd/phpmd

PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.

2.4k108.5M4.8k](/packages/phpmd-phpmd)[h4cc/phpqatools

A meta composer package for PHP QA Tools.

6418.6k1](/packages/h4cc-phpqatools)[oxid-esales/testing-library

OXID eShop testing library

13374.0k10](/packages/oxid-esales-testing-library)[jdlabails/php-project-analyzer-bundle

Symfony Bundle for PhpProjectAnalyzer

1210.8k](/packages/jdlabails-php-project-analyzer-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
