landingi/crap-metric-analyzer
A PHP package for analyzing CRAP metrics, combining cyclomatic complexity and test coverage to identify high-risk, hard-to-maintain code. Helps teams prioritize refactoring and improve coverage where it matters most.
composer require --dev <vendor>/<package> (confirm the exact name in the release/README) and, if the package ships a config file, publish it with php artisan vendor:publish.php artisan test --coverage-clover=build/coverage/clover.xml
Then point the package at that file through its config or API. If you are on v1.0.4+, verify your generated clover file matches the newest structure before wiring it into CI.
clover.xml in CI, parse it with the package, and fail the build when coverage drops below a threshold. Keep the clover generation and parsing steps in the same job so the report matches the code under test.coverage:report) so local developers and CI use the same code path. Return a non-zero exit code when thresholds fail.composer.json. Treat the clover schema as part of your dependency contract.// Illustrative: parse once, then apply your own threshold logic.
$report = $coverage->parse('build/coverage/clover.xml');
if ($report->totalPercentage() < 80.0) {
return self::FAILURE;
}
How can I help you explore Laravel packages today?