PHP Mess Detector

Author(s)
Manuel Pichler
Website
https://phpmd.org/
License
BSD 3-clause "New" or "Revised" License
GitHub
phpmd/phpmd
Packagist
phpmd/phpmd
DockerHub
phpqa/phpmd

0 0 0

PHP Mess Detector scans PHP source code and looks for potential problems such as possible bugs, dead code, suboptimal code, and overcomplicated expressions.

PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. It can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.

Installation

Install from a Composer package as a dev dependency (with Composer)

Make sure you have Composer installed.

Require it as a dev dependency:
composer require --dev phpmd/phpmd
Run it:
php vendor/bin/phpmd

Install from a Git repository (with Git)

Make sure you have git and Composer installed.

Git clone the repository:
git clone git://github.com/phpmd/phpmd.git
Change into the new directory:
cd phpmd
Update the submodules:
git submodule update --init
Install the project dependencies:
composer install
Run it:
src/bin/phpmd

Install from a PHP Archive (with curl or wget)

The PHPUnit documentation has a clear manual on how to install PHARs on Windows.

If you have the Suhosin extension enabled, make sure to allow the execution of PHARs in your php.ini:
suhosin.executor.include.whitelist = phar

Locally
Download it:
wget -O phpmd.phar https://static.phpmd.org/php/latest/phpmd.phar
or
curl -sSL https://static.phpmd.org/php/latest/phpmd.phar -o phpmd.phar
Use it:
php phpmd.phar
Globally
Download it:
wget -O phpmd.phar https://static.phpmd.org/php/latest/phpmd.phar
or
curl -sSL https://static.phpmd.org/php/latest/phpmd.phar -o phpmd.phar
Install it as an executable:
chmod a+x phpmd.phar
sudo mv phpmd.phar /usr/local/bin/phpmd
Use it:
phpmd