PHP Copy/Paste Detector

(( gitHubWatchers )) (( gitHubStars )) (( gitHubForks ))

PHP Copy/Paste Detector is a Copy/Paste Detector for PHP code.

It scans a PHP project for duplicated code, in order to "Don't Repeat Yourself" (DRY).

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 sebastian/phpcpd
Run it:
php vendor/bin/phpcpd

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 phpcpd.phar https://phar.phpunit.de/phpcpd.phar
or
curl -sSL https://phar.phpunit.de/phpcpd.phar -o phpcpd.phar
Use it:
php phpcpd.phar

Globally

Download it:
wget -O phpcpd.phar https://phar.phpunit.de/phpcpd.phar
or
curl -sSL https://phar.phpunit.de/phpcpd.phar -o phpcpd.phar
Install it as an executable:
chmod a+x phpcpd.phar
sudo mv phpcpd.phar /usr/local/bin/phpcpd
Use it:
phpcpd