NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #3668 most downloaded on Packagist
Copy/Paste Detector for PHP code
Latest stable
v9.2.0
Last release 1 months ago
18 Oct 2026
Release timing varies
gaps range from 2 weeks to 12 months
Nearly every release is documented
notes for 13 of 13 stable releases
Nothing withdrawn
no release was ever pulled
3 years old
13 releases · first in 2024
Drag across the ruler to compare, or tap a release to open it.
🚀 Release v9.2.0: Algorithmic Overhaul & Unprecedented Precision
🚀 Release v9.2.0: Algorithmic Overhaul & Unprecedented Precision
This release brings a massive architectural overhaul to the core scanning engines of phpcpd, introducing true O(1) hashing algorithms, early-exit strategies, and character-level tokenization. The result is a profoundly faster, mathematically accurate detection engine capable of handling Enterprise-scale codebases with flat scaling.
⚡ Performance Breakthroughs
O(1) Rolling Hash (Rabin-Karp): Completely rewrote the default Rabin-Karp hashing engine. We replaced the memory-heavy md5(substr()) operations with a true Double Polynomial Rolling Hash. This eliminates expensive string allocations in memory.
Suffix Tree "Fast Path" (O(N²) to O(N)): Historically, the Suffix Tree allocated heavy Levenshtein distance matrices even for exact matches. We introduced a "Fast Path" early-exit strategy that bypasses the dynamic programming matrix in favor of direct token-by-token comparison when --edit-distance=0.
Early Scanning Cutoff: The Suffix Tree traversal is now strictly constrained by the --min-tokens limit. If the remaining unparsed tokens are fewer than the required minimum, the engine immediately halts that branch, eliminating impossible tail evaluations.
🎯 Precision Enhancements & Bug Fixes
Character-Level Precision (Fix & Enhancement): Previously, both engines ignored single-character tokens returned as strings by token_get_all() (such as +, *, =, {). This caused false-positive clones between methods with identical structures but different math/logic, and completely missed valid architectural clones. Both DefaultStrategy and SuffixTreeStrategy now capture these primitives via their ASCII values (ord()), ensuring flawless structural comparison.
Fixed Suffix Tree Map Overwrite (Bug Fix): Fixed a critical deduplication bug where clones starting on the exact same line number in different files would silently overwrite each other. The internal map now securely uses a composite key ($ci->token->file . ':' . $ci->token->line), preventing false-negative clone drops during massive directory scans.
📊 Real-World Benchmarks
Rabin-Karp Scale Test (138,272 LOC): The new Rolling Hash delivers a 12% baseline speedup (2.33s vs 2.65s) on default settings, and cuts execution time by 45% (1.93s vs 3.53s) when detecting massive clones (--min-tokens=1000).
Suffix Tree Optimizations: The new Fast Path and Early Cutoff deliver a 90%+ speedup for exact matches (dropping execution from ~22s to fractions of a second on highly dense files) and a 35-40% time reduction for Type-3 fuzzy detection.
Suffix Tree Scale Test (9,200 LOC): The upgraded engine uncovers hidden clones missed in v9.1.0, parsing the volume in ~17 seconds for mathematically exact matches, and ~45 seconds when running deep Type-3 fuzzy analysis (--edit-distance=5).
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Add JSON and SARIF 2.1.0 loggers for CI/CD integrations
[inconsistent] clone detection and fix fuzzy matching logic--exclude optionConfig builder pattern loaded from phpcpd.config.php with a dist template--quiet option to suppress non-essential CLI output for CI/CD environments (fixes #205)--max-percentage and --ignore-violations-on-exit options (fixes #190)Updated the minimum PHP requirement to version 8.4, meaning this tool is no longer supported on PHP 8.3.
Added --ignore-no-files option to return a success exit code if no files were found.
--ignore-no-files option to return a success exit code if no files were found.#[SuppressCpd] to ignore code clones inside a class or method (use Systemsdk\PhpCPD\Attributes\SuppressCpd;).phpcpd 8.2.4 release. Updated sebastian/cli-parser. Dev environment: Updated XDebug, Phive, Phing, dev composer dependencies.
phpcpd 8.2.4 release. Updated sebastian/cli-parser. Dev environment: Updated XDebug, Phive, Phing, dev composer dependencies.
Improved html report and DataTables buttons, updated bootstrap and DataTables to the latest version.
Improved html report and DataTables buttons, updated bootstrap and DataTables to the latest version.
phpcpd 8.2.2 release. Improved progress bar.
phpcpd 8.2.2 release. Improved progress bar.
phpcpd 8.2.1 release. Fixed codefragment value for xml report.
phpcpd 8.2.1 release. Fixed codefragment value for xml report.
phpcpd 8.2.0 release. Added possibility to generate html report, extended report xml file, fixed some bugs, updated documentation.
phpcpd 8.2.0 release. Added possibility to generate html report, extended report xml file, fixed some bugs, updated documentation.
phpcpd 8.1.1 release. Available installation via composer.
phpcpd 8.1.1 release. Available installation via composer.
phpcpd 8.1.0 release. Added Suffix Tree-based algorithm for code clone detection (experimental), added progress bar. Made codebase refactoring. Update
phpcpd 8.1.0 release. Added Suffix Tree-based algorithm for code clone detection (experimental), added progress bar. Made codebase refactoring. Updated packages: sebastian/cli-parser, sebastian/version, phpunit/php-file-iterator, phpunit/php-timer. Updated tests to the PHPUnit 12.
phpcpd 8.0.0 release. Made codebase refactoring. Updated requirements php 8.3, updated composer dependencies, updated tests to the PHPUnit 11. Updated
phpcpd 8.0.0 release. Made codebase refactoring. Updated requirements php 8.3, updated composer dependencies, updated tests to the PHPUnit 11. Updated dev environment to the php 8.4, Phing 3.0, added code quality tools: ecs, phpstan.
Skip php attributes from analysis (including multilines attributes, see example inside tests/fixture/Math.php)
Skip php attributes from analysis (including multilines attributes, see example inside tests/fixture/Math.php)
One column per month.