- What is vstelmakh/covelyzer and what does it do?
- Covelyzer is a standalone PHP CLI tool that analyzes PHPUnit code coverage reports in Clover XML format. It highlights uncovered code, summarizes coverage by file, and helps teams keep coverage visible in CI. It is not a Laravel package with a service provider or facade, so it integrates by running against a generated coverage.clover file.
- How do I install covelyzer in a Laravel project?
- Install it with Composer as a development dependency using composer require --dev vstelmakh/covelyzer. It provides a vendor/bin/covelyzer binary that you can run locally or in CI. Commit your composer.json and composer.lock changes so pipelines install the same version.
- Does covelyzer work with Laravel's PHPUnit tests?
- Yes, because Laravel applications use PHPUnit for testing and PHPUnit can generate Clover XML coverage reports. Covelyzer only needs the Clover file, so there is no deep framework coupling or Laravel-specific configuration required. Run your Laravel tests with Clover coverage enabled, then pass the resulting file to the covelyzer binary.
- How do I generate the Clover XML report covelyzer needs?
- Use PHPUnit's --coverage-clover option, for example phpunit --coverage-clover=coverage.clover, or configure a coverage clover entry in phpunit.xml. In Laravel projects, you can run PHPUnit directly or use php artisan test with coverage options supported by your Laravel version. Confirm that the generated file is valid Clover XML before running covelyzer.
- Can I enforce a minimum coverage threshold in CI with covelyzer?
- Covelyzer is intended to help teams enforce coverage quality thresholds and keep uncovered code visible. A common CI pattern is to generate coverage.clover, run ./vendor/bin/covelyzer coverage.clover, and fail the job when the command exits non-zero or when your configured threshold is not met. Check the CLI help for the exact threshold options available in the version you install.
- Is covelyzer compatible with Laravel 10 or 11 and PHP 8?
- There is no direct Laravel dependency, but the package's last release was in 2020, before PHP 8 and PHPUnit 9 became common. Modern Laravel 10 or 11 projects on PHP 8+ should test it carefully and may need a fork or compatibility patches. For new projects, evaluate maintained alternatives or pin a known-working toolchain.
- Does covelyzer support HTML, LCOV, or other coverage formats?
- Covelyzer is focused on Clover XML coverage reports. It is not a multi-format coverage viewer, so teams that need HTML, LCOV, or other formats will require additional tooling. Generate Clover XML with PHPUnit's --coverage-clover option and use covelyzer for Clover-based analysis.
- How do I integrate covelyzer into GitHub Actions or GitLab CI?
- Add a CI step after your test job that generates coverage.clover and runs ./vendor/bin/covelyzer coverage.clover. You can let a non-zero exit fail the job or use || exit 1 for clarity. In GitHub Actions this is a normal run step, and in GitLab CI it belongs in the script section of your job.
- Can I wrap covelyzer in a custom Artisan command?
- Yes, because covelyzer is a standalone CLI binary you can call from a custom Artisan command. Generate the Clover file with PHPUnit, shell out to vendor/bin/covelyzer, and return its exit code from the command. Register the command in app/Console/Kernel.php or use Laravel's command discovery and document the workflow for your team.
- Is covelyzer still maintained, and what are the alternatives?
- The last release was in 2020, so treat maintenance as a risk and decide who owns updates, patches, or a fork. Alternatives include PHPUnit's built-in coverage output, php-coveralls/php-coveralls for multi-format coverage uploads, and platforms such as SonarQube or Coveralls. Choose based on whether you need Clover-only threshold checks or broader coverage reporting.