sebastian/phpcpd
PHPCPD is a copy/paste detector for PHP that finds duplicated code (clones) across files and reports duplicate lines and locations. Distributed as a PHAR and installable via Phive. Note: this project is unmaintained and archived.
PHPCPD is an archived, no-longer-maintained CLI tool for detecting copy-paste duplicates in PHP code. To begin:
phive install phpcpd — never use Composer, per the author’s recommendation.app/ directory: ./tools/phpcpd app/% duplicated lines and Average size of duplication. Values >1–2% duplication or clones >50 lines are strong refactoring candidates.--fail threshold only on new code (e.g., phpcpd --minimum-lines 15 app/ && php phpunit.xml --testdox), or use --dry-run to report without exit code impact.--exclude to omit tests/, database/, and vendor/, and --suffixes .php to avoid non-PHP noise.--log-pmd cpd.xml and feed into IDE plugins (e.g., PHPStorm’s built-in CPD viewer) or dashboards like SonarQube for recurring visibility.php -v and consider maintaining a fork for critical fixes.php -d memory_limit=2G ./tools/phpcpd app/.--fuzzy catches “almost identical” clones (e.g., changed variable names), but may flag legitimate factory patterns. Use --minimum-lines 20 to ignore small boilerplate snippets.sebastian/cli-parser can conflict with other CLI tools using symfony/console 6+. Run via isolated PHAR to avoid version skew in global toolchains.How can I help you explore Laravel packages today?