johnatas-x/phpcpd
Laravel-friendly wrapper for PHP Copy/Paste Detector (PHPCPD) to spot duplicated code in your PHP projects. Run duplication checks from your tooling/CI and get actionable reports to reduce redundancy and improve maintainability.
phpcpd package is a static analysis tool designed to detect duplicate code in PHP projects, aligning well with code quality, maintainability, and refactoring initiatives in a Laravel-based application.phpcpd locally on a subset of modules to validate output quality.phpcpd:check).main.vendor/ and generated files (e.g., bootstrap/cache).phpunit/phpunit or symfony/console if used.| Phase | Action | Owner |
|---|---|---|
| Assessment | Validate tool output against manual reviews. | Dev Lead |
| Setup | Install phpcpd globally or via Composer (require-dev). |
Backend Engineer |
| CI Integration | Add pipeline job with configurable thresholds. | DevOps/TPM |
| Feedback Loop | Gather developer feedback on false positives/negatives. | Tech Lead |
| Optimization | Adjust thresholds, exclude false-positive paths, or extend reporting. | TPM/Dev Team |
composer.json..phpcpd.exclude).memory_limit adjustments.| Failure Type | Impact | Mitigation Strategy |
|---|---|---|
| False Positives | Developers ignore tool output. | Calibrate thresholds; document exclusion rules. |
| CI Timeouts | Pipeline failures. | Run in parallel; increase timeout limits. |
| High False Negatives | Misses critical duplicates. | Supplement with manual reviews or other tools. |
| Configuration Drift | Inconsistent enforcement. | Version-control .phpcpd.yml; enforce via PR checks. |
| Tool Abandonment | No updates/security patches. | Fork or migrate to alternatives (e.g., Simian). |
How can I help you explore Laravel packages today?