soyhuce/phpinsights-formatter
The soyhuce/phpinsights-formatter package adds a custom formatter to PHP Insights, turning code-quality analysis into a clean, readable report. It helps teams review scores, issues, and metrics more easily in local runs and CI pipelines for Laravel and PHP projects.
composer require --dev nunomaduro/phpinsights soyhuce/phpinsights-formatter
The formatter is not a runtime dependency — keep it in require-dev so it doesn't ship to production.php vendor/bin/phpinsights --config-path=config/insights.php (or php artisan insights if you use the Laravel wrapper). This is where presets, excluded paths, and thresholds live before you touch formatting.--format= flag.php vendor/bin/phpinsights --no-interaction --format=<formatter> > build/insights.xml
Wire that single command into CI, upload build/insights.xml as an artifact, and you're done — the local workflow stays php vendor/bin/phpinsights."scripts": {
"insights": "phpinsights --no-interaction",
"insights:report": "phpinsights --no-interaction --format=<formatter> --quiet > build/insights.xml"
}
insights:report with a report-only intent (collect and publish) and let a second, plain insights invocation own the pass/fail gate. This keeps the CI report populated even on red builds, which is exactly when you want it.config/insights.php still has permissive min-quality/min-complexity/min-architecture/min-style values, then ratchet them up over successive PRs.--format= value must match a formatter the package registers; a typo produces a generic "invalid format" error rather than a list. Check the README/src/ for the exact identifiers before debugging your YAML.|| true (or capture then re-raise) when you specifically want the artifact to survive a failing build.--no-interaction is mandatory in CI, otherwise the run can hang waiting on a prompt.composer.json and bump them together. A PHP Insights major/minor bump can silently change what the formatter receives.actions/checkout 3→4, ramsey/composer-install 1→2, git-auto-commit-action 4→5, fetch-metadata), a README update, and PHP 8.3 added to the test matrix. No formatter API changes, no config changes, no deprecations. Dropping it in from 2.0.0 is a low-risk composer update and buys you a verified PHP 8.3 signal rather than new behaviour.How can I help you explore Laravel packages today?