node package manager


Grunt plugin for running PHP Copy/Paste Detector (PHPCPD).


Grunt plugin for running PHP Copy/Paste Detector (PHPCPD).

This plugin is developed for Grunt 0.4.0 and is not tested for backward compatibility with Grunt 0.3.x.

  1. Install this grunt plugin with the follwing command:
npm install grunt-phpcpd --save-dev
  1. Install PHPCPD

  2. Add this to your project's Gruntfile.js:


Run this task with the grunt phpcpd command.

This task is a multi task so any targets, files and options should be specified according to the multi task documentation.

phpcpd: {
  application: {
      dir: 'application'
    options: {
      quiet: true

Type: String

The file or directory where phpmd should search for files.

Type: String Default: 'phpcpd'

The binary name if it is in your PATH or the full path if not.

Type: String Default: false

Set a path and filename here to write to a file, otherwise it will write to stdout.

Type: String Default: false

Exclude <dir> from code analysis. Also supports Array syntax for excluding multiple directories.

Type: Number Default: 5

Minimum number of identical lines.

Type: Number Default: 70

Minimum number of identical tokens.

Type: Boolean Default: false

Use fuzz variable names.

Type: String Default: '*.php'

A comma-separated list of file names to check.

Type: Boolean Default: true

Only print the final summary.

Type: Boolean Default: false

Print duplicated code.

Type: String Default: false

Write report in PMD-CPD XML format to .

Type: Number Default: 200*1024

Override the maxBuffer-Size of nodejs's exec() function if you expect a long output on stdout.

Type: Boolean Default: false

Ignore the exit code if you don't want the task to fail (e.g. CI-Server).