Download the PHP package detain/php-dup-finder without Composer
On this page you can find all versions of the php package detain/php-dup-finder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download detain/php-dup-finder
More information about detain/php-dup-finder
Files in detain/php-dup-finder
Package php-dup-finder
Short Description AST-based PHP duplicate-logic detector and refactoring assistant.
License MIT
Informations about the package php-dup-finder
phpdup — AST-based PHP duplicate-logic detector
A semantic clone detector and refactoring assistant for PHP codebases. Behaves more like an "extract function" advisor than a copy/paste finder.
phpdup parses every file in a PHP codebase into an Abstract Syntax
Tree, normalizes those ASTs into a canonical form, and finds clusters
of parameterizable duplication — places where the shape of the
code repeats and only literals, identifiers, method names, table
names, or whole optional segments of code vary.
For each cluster it doesn't just point at the duplicates, it tells you what the abstraction would look like — its parameter list, types, and a suggested function name — ready to drop into a refactor.
A run on tests/Fixtures returns its top 2 clusters by impact. Each
cluster's "Suggested abstraction" box is the function signature
phpdup is recommending you extract; the "Holes" table lists every
parameter with its inferred type and the values observed across cluster
members. Compare with classic copy/paste detectors that only highlight
the duplication; phpdup tells you the threshold and the role string
are the parameters of the abstraction with their inferred types and
observed values, ready to apply.
Quick start
Install
Status (verified against the live releases API, 2026-11-22): no tag has been published through the release workflow yet — the only release,
v1.0.0, predates the signing/publishing chain in.github/workflows/release.ymland carries no assets, so the phar URLs below currently return 404. The workflow attaches them to everyv*tag pushed from now on.
PHAR (recommended once published). The release workflow builds a self-contained phar, signs a tag-bound release manifest, and attaches the artifact, its checksum sidecar, the manifest and signature, build metadata and release notes to the GitHub release:
The sidecar confirms the download arrived intact; it authenticates nothing.
phpdup self:update instead verifies the signed manifest before
replacing the phar — see docs/RELEASE.md.
Composer — not supported yet. composer require --dev detain/php-dup-finder does not resolve from a fresh stable project: the
package depends on 16 sugarcraft/* libraries pinned to dev-master#<sha>,
and pinned dev-version VCS requirements cannot be pulled in transitively —
the consuming root would have to declare the repositories and
minimum-stability: dev itself. Until those dependencies ship resolvable
tags, use from source instead:
Then run the CLI from the checkout via its launcher, e.g.
bin/phpdup analyze src (the Analyze/View sections below all use it).
To upgrade a source install: git pull && composer install.
Analyze
View report
Key CLI flags
| Flag | Default | Description |
|---|---|---|
--config, -c |
— | Load settings from phpdup.json |
--json FILE |
— | Structured JSON report |
--html DIR |
— | Interactive HTML report |
--min-impact N |
20 |
Minimum cluster impact (≈ duplicated lines) to include |
--min-block-size N |
8 |
Minimum AST node count per block |
--kinds K1,K2 |
all | Block kinds to analyze: method, closure, function, if, for, etc. |
--exact-only |
off | Skip near-duplicate detection (fast Type-1 only) |
--optional-blocks on/off |
on |
Enable Type-3 / optional-segment detection |
--mode strict/default/aggressive |
aggressive |
Normalization strictness |
--similarity N |
0.80 |
Jaccard threshold for near-duplicate phase |
--db-aware |
off | Enable ORM-aware semantic deduplication (Eloquent, Doctrine, PDO, etc.) |
--workers N, -j |
0 |
Worker count (0 = auto-detect from CPU cores) |
--auto-tune |
off | Probe corpus and pick size-appropriate defaults |
--tui |
off | Show interactive SugarCraft dashboard |
--watch |
off | Re-run analysis on file changes (poll-based) |
Full reference: docs/CLI.md
Documentation
| Topic | File |
|---|---|
| CLI flag reference | docs/CLI.md |
HTTP API server (phpdup serve) |
docs/SERVER.md |
| CI/CD integration recipes | docs/CI.md |
| JSON config schema | docs/config-schema.json |
| ML pair-similarity sidecar | docs/ML.md |
| ML training corpus format | docs/ml-corpus-format.md |
| Release & distribution process | docs/RELEASE.md |
| Playground front-end | docs/PLAYGROUND.md |
| JetBrains IDE plugin contract | docs/JETBRAINS_PLUGIN.md |
Table of contents
The long-form guide sections were moved into the docs tree; this index maps each topic to where it actually lives. Every link is checked in CI.
- Quick start — install the phar, or from source
- Key CLI flags — the everyday table
- CLI reference — full flag and sub-command reference
- Sub-commands —
analyze/serve/init/self:update/completion - Tuning & Type-3 detection — thresholds, normalization modes,
--optional-blocks,--db-aware,--trinity-collapse - Output formats — JSON, HTML, SARIF, GitLab SAST, diff, checkstyle, CSV, Prometheus, time-series, Graphviz, PlantUML, refactor patches, PHPUnit skeletons
- File counters — scan signals, skips, exclude typos, parse failures
- Runtime flags — workers, memory ceiling, cache toggles
- Cache retention and pruning — content-addressed disk cache, documented rm-based reclaim
- TUI and watch mode —
--tui,--theme,--watch, keyboard shortcuts - CI baseline gate —
--baseline/--baseline-out, incremental exit-code 4 workflow - Config validation —
--validate-config - Self-update —
phpdup self:updateand the signed-manifest contract - Exit codes — 0 / 1 / 2 / 3 / 4
- Configuration file —
phpdup.jsonfields (+ machine-readable schema above) - Configuration precedence — per-directory overrides, project profiles
excludeglob dialect — how exclude lists stack- Examples — threshold-gated, CRUD, optional segments, strategy dispatch
phpdup serveREST API — health, sync/async analyze, job polling- Server security — bind defaults, bearer token, path confinement
- Clustering algorithm — phases, medoid-ball split, complexity
- Anti-unification — hole typing
- Architecture — cooperative-pipeline ADR (with 0002/0003 siblings)
- CI integration — composite action, GitLab/Jenkins/Circle/Travis recipes
- Tutorials — 10k-line walkthrough (also
laravel.md,anti-unification-deep-dive.md) - Benchmarks — comparative harness, feature matrix, committed raw results (
bench/results/) - License — MIT
License
MIT — see LICENSE
All versions of php-dup-finder with dependencies
ext-hash Version *
ext-gmp Version *
nikic/php-parser Version ^5.0
symfony/console Version ^6.4 || ^7.0
sebastian/diff Version ^5.1 || ^6.0
sugarcraft/candy-core Version dev-master
sugarcraft/candy-zone Version dev-master
sugarcraft/candy-hermit Version dev-master
sugarcraft/candy-kit Version dev-master
sugarcraft/candy-log Version dev-master
sugarcraft/candy-palette Version dev-master
sugarcraft/candy-sprinkles Version dev-master
sugarcraft/sugar-bits Version dev-master
sugarcraft/sugar-charts Version dev-master
sugarcraft/sugar-crumbs Version dev-master
sugarcraft/sugar-prompt Version dev-master
sugarcraft/sugar-spark Version dev-master
sugarcraft/sugar-stickers Version dev-master
sugarcraft/sugar-table Version dev-master
sugarcraft/sugar-toast Version dev-master
sugarcraft/sugar-veil Version dev-master