halleck45/phpmetrics-collector-bundle
Symfony bundle that runs PhpMetrics against your codebase, saves the reports in a database via Doctrine, and serves a web dashboard for tracking code quality metrics over time. Includes console commands to collect metrics and compare trends between builds.
Architecture fit — poor as packaged, salvageable as a component. The package is a Symfony bundle that registers a DataCollector with Symfony's WebProfilerBundle and renders a panel in the Symfony debug toolbar. Laravel has no equivalent extension point: its debug bar (barryvdh/laravel-debugbar) wraps PHP DebugBar's DataCollectorInterface, a different abstraction. Every Laravel integration path requires replacing the bundle's Symfony wiring rather than reusing it. The genuinely portable asset is the upstream phpmetrics/phpmetrics analysis engine, which is framework-agnostic.
Integration feasibility — low for the bundle, moderate for the engine. Two viable paths:
phpmetrics/phpmetrics as a dev dependency and run it in CI, publishing the HTML report as a build artifact / GitLab Pages / GitHub Pages target. Zero framework coupling, no fork to maintain.git rev-parse HEAD + file mtime hash. Estimated 1–3 days of engineering; the bundle itself contributes little more than a reference UI.Note the conceptual mismatch: PhpMetrics performs static analysis (cyclomatic complexity, maintainability index, Halstead, coupling, LCOM). It is not a runtime profiler. Embedding it in a debug bar implies analyzing the whole codebase on a request — a pattern that only works behind aggressive caching and is better served by an on-demand command or CI job.
Technical risk — elevated. Signals: 51 stars, 0 dependents, stale Symfony constraint set, and an "opportunity" score of 0.34 (low incremental value versus existing QA tooling). Risks include: composer conflicts from old symfony/* constraints in a modern Laravel app; incompatibility of the bundle with PHP 8.2/8.3 and Laravel 10–12; no production validation anywhere; and reliance on WebProfilerBundle, which is a dev-only, version-sensitive internal.
Key questions for the team:
phpmetrics/phpmetrics still release against them?Stack fit. Do not install the bundle in a Laravel application. Treat the repository as reference material: it demonstrates how to wire PhpMetrics into a debug surface. Reuse the engine (phpmetrics/phpmetrics), discard the Symfony integration layer.
Migration path.
composer require --dev phpmetrics/phpmetricsphp artisan quality:metrics) that invokes the analyzer against app/, src/, or configured paths and writes JSON to storage/app/metrics/.App\Support\DebugBar\PhpMetricsCollector implements DataCollectorInterface and register it via the debugbar.collectors config key, guarded by APP_DEBUG and a metrics.enabled flag.Compatibility.
composer.json.symfony/web-profiler-bundle or the bundle's transitive Symfony constraints into the application — conflict risk is high and the benefit is nil.DataCollectorInterface signature before writing the collector; this interface has changed across PHP DebugBar majors.Sequencing.
Maintenance. The bundle has no meaningful maintenance signal and zero dependents — we would be the sole consumer of any fork. Owning a fork of a Symfony dev-tool bundle inside a Laravel codebase is a poor long-term trade. The CLI path reduces our maintainable surface to a pinned dev dependency and one Artisan command.
Support. No vendor support; small community (~51 stars) means Stack Overflow and issue-tracker answers will be thin. Internal ownership and documentation are mandatory. Budget a named owner for the quality-tooling domain.
Scaling. Static analysis cost scales with codebase size, not traffic — safe in CI, unsafe per request. Large monorepos may need path scoping, memory limit raises (-d memory_limit=1G), and parallelism. The debug bar panel, if built, must read a cached artifact and degrade gracefully to "no report available" rather than triggering analysis inline.
Failure modes to design for.
class_exists/interface-version guard.Ramp-up. Low for the CLI/report path — a mid-level engineer can wire it in a day. Moderate for a custom collector, mainly in learning PHP DebugBar's collector contract and rendering API. The larger ramp is interpretive: the team must be able to read complexity, maintainability index, and coupling scores and convert them into review guidance, otherwise the report is decorative.
TPM recommendation. Score the package itself as do-not-adopt: the Symfony-specific surface does not transfer, and the project shows no adoption or maintenance momentum. Adopt the underlying phpmetrics/phpmetrics engine as a CI-only quality artifact, gate on deltas rather than absolutes, and defer any Laravel debug-bar UI to a small, opt-in, cached collector built in-house if developer demand is demonstrated.
How can I help you explore Laravel packages today?