vstelmakh/covelyzer
Covelyzer analyzes PHP code coverage reports and enforces per-class and per-method thresholds, failing CI builds when coverage drops below configured limits. It offers a clear console summary and flexible rules for teams tracking test quality.
vstelmakh/covelyzer) is a PHPUnit test coverage analyzer for Clover XML reports, making it a niche but valuable tool for quality assurance (QA) and test-driven development (TDD) workflows in PHP/Laravel projects.
phpunit.xml, phpunit facade) without deep framework coupling.--coverage-clover in PHPUnit).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Stale Package | High | Fork/maintain or replace with active alternatives (e.g., php-coveralls/php-coveralls). |
| Limited Features | Medium | Supplement with other tools (e.g., jacoco-report for Java-like metrics). |
| Clover XML Dependency | Medium | Ensure CI generates Clover reports (default in PHPUnit). |
| No Laravel-Specific Docs | Low | Document custom Laravel integration in team wiki. |
php-coveralls/php-coveralls (supports multiple formats).phpunit/phpunit (built-in coverage tools).jacoco-report (for Java-like metrics).--coverage-clover=coverage.clover.covelyzer in a custom command for Laravel-specific triggers (e.g., php artisan coverage:check).--coverage-clover to phpunit.xml:
<phpunit>
<logging>
<coverage clover="coverage.clover"/>
</logging>
</phpunit>
./vendor/bin/phpunit --coverage-clover=coverage.clover
./vendor/bin/covelyzer coverage.clover
.github/workflows/ci.yml:
- name: Check Coverage
run: ./vendor/bin/covelyzer coverage.clover || exit 1
// app/Console/Commands/CheckCoverage.php
public function handle() {
$coverageFile = storage_path('coverage.clover');
$exitCode = shell_exec("php artisan test --coverage-clover=$coverageFile && vendor/bin/covelyzer $coverageFile");
if ($exitCode !== 0) exit(1);
}
app/Console/Kernel.php:
protected $commands = [
Commands\CheckCoverage::class,
];
composer.json:
"require-dev": {
"vstelmakh/covelyzer": "^1.0"
}
php-coveralls).phpunit --coverage-text or php-coveralls if covelyzer fails.composer.json).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Clover XML not generated | Build fails silently | Add validation step in CI. |
| Coverage threshold breach | PRs blocked | Communicate thresholds upfront. |
| Package compatibility issues | CI pipeline breaks | Fork or switch to maintained tool. |
| No active maintenance | Security/bug risks | Set reminder to evaluate alternatives. |
phpunit.xml to generate Clover reports.covelyzer to CI with failure conditions.covelyzer output (e.g., --min=80).How can I help you explore Laravel packages today?