phpcpd-next
phpcpd-next is a token-based detector for copied and similar PHP code across a repository.
What phpcpd-next is
phpcpd-next is a token-based detector for copied and similar PHP code across a repository. It targets PHP 8.4 and later and is a successor to Sebastian Bergmann’s phpcpd. By default, it combines Rabin-Karp exact matching with TokenBag detection for reordered code; an optional unified engine checks for exact, renamed, gapped, and reordered clones. An optional orphan mode finds unreferenced classes, interfaces, traits, enums, and functions. Reports are available in the console and in PMD-CPD XML, JSON, or SARIF 2.1.0 formats. CI features include meaningful exit codes, result caching, and a per-file incremental index; clone findings return status 1. The project documents PHPUnit integration, a headless API, framework presets, and SARIF upload to GitHub Code Scanning. It is free and MIT-licensed, with no Composer runtime dependencies, but requires PHP 8.4 or later, ext-dom, and ext-mbstring. Installation options include Composer or building from source. The project cautions that advanced engines are research-grade and may produce more false positives than the default set.
Good
- Free and MIT-licensed.
- Provides console, XML, JSON, and SARIF reports.
- Includes caching and an incremental index for CI.
- Documents PHPUnit and GitHub Code Scanning integrations.
- Has zero Composer runtime dependencies.
Watch out
- Requires PHP 8.4 or later.
- Requires ext-dom and ext-mbstring.
- Advanced engines may have higher false-positive rates.
- No IDE integration is listed.
Who it suits
phpcpd-next may suit PHP developers who want to locate code clones in repositories or add clone findings to CI. Its requirements make it a fit for projects using PHP 8.4 or later with the required extensions.
Verdict
phpcpd-next offers several clone-detection modes and report formats, with features for CI workflows. The optional advanced engines carry a stated false-positive caveat, and duplicated-line percentages do not replace review of structural repetition in code design.
Plans and prices
From phpcpd-next's own pricing page, checked 5 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| Open source | Free | MIT licensed · requires PHP 8.4+ with ext-dom and ext-mbstring · install via Composer |
The facts
Each one read from phpcpd-next's own pages, with the date it was checked.
What it does
- CI use
- Meaningful exit codes, result caching, and a per-file incremental index support CI use; clone findings produce exit status 1.checked 5 Oct 2026
- Detection
- Its default run combines Rabin-Karp exact matching with TokenBag detection of reordered code; an opt-in unified engine detects exact, renamed, gapped, and reordered clones.checked 5 Oct 2026
- Integrations
- The project documents PHPUnit integration, an in-process headless API, framework presets, and SARIF upload to GitHub Code Scanning.checked 5 Oct 2026
- License
- The project states that phpcpd-next is licensed under MIT.checked 5 Oct 2026
- Limit: design repetition
- The README says the duplicated-line percentage measures copied tokens and cannot substitute for reviewing structural repetition in code design.checked 5 Oct 2026
- Limit: research engines
- The README describes advanced engines as opt-in and research-grade, with higher false-positive rates on real-world code than the default set.checked 5 Oct 2026
- Orphan detection
- The optional --orphans mode finds unreferenced classes, interfaces, traits, enums, and functions.checked 5 Oct 2026
- Purpose
- phpcpd-next is a token-based copy/paste detector for PHP 8.4+ and a successor to Sebastian Bergmann’s phpcpd.checked 5 Oct 2026
- Reports
- It provides console, PMD-CPD XML, JSON, and SARIF 2.1.0 output formats.checked 5 Oct 2026
- Requirements
- It requires PHP 8.4+, ext-dom, and ext-mbstring, and lists zero Composer runtime dependencies.checked 5 Oct 2026
- Setup
- The documented installation is as a Composer development dependency, as a global Composer package, or from source.checked 5 Oct 2026
- Support
- The opened project page describes contribution guidance and a Contributor License Agreement; it does not state a paid support plan.checked 5 Oct 2026
The company
- Founded
- 2026checked 28 Sep 2026
Alternatives to phpcpd-next
- 1
Dolos
Free planOpen sourceWebAPILinuxmacOS7.7Free plan - 2

jscpd
Free planOpen sourceAPILinuxmacOSSelf-hosted7.4Free plan - 3
Avidemux
Free planOpen sourceWebLinuxmacOSWindows7.3Free plan - 4
PMD
Free planLinuxmacOSSelf-hostedWindows6.8Free plan - 5
Duplo
Free planLinuxmacOSWindows6.5Free plan - 6
dcd
Free planLinuxmacOS6.2Free plan
