laxit / clover-to-lcov
Converts your Phpunit's Clover xml report to CI friendly LCOV report
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/laxit/clover-to-lcov
Requires
- php: ^8.1
- ext-simplexml: *
Requires (Dev)
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-12-12 13:59:23 UTC
README
๐ Verdant Cloverstone
Clover to LCOV Converter โ transforms PHPUnit's Clover XML coverage reports into the universal LCOV format.
The Verdant Cloverstone converts raw, scattered data into a polished, unified report, embodying the precise transformation of Clover XML into the LCOV standard.
Why?
PHPUnit generates Clover XML coverage reports, but many CI tools (GitHub Actions, GitLab CI, Codecov, Coveralls) prefer LCOV format. This package bridges that gap.
clover.xml โ ๐ โ coverage.lcov
Installation
composer require laxit/clover-to-lcov
Usage
CLI
# Output to stdout ./vendor/bin/clover-to-lcov coverage/clover.xml # Output to file ./vendor/bin/clover-to-lcov coverage/clover.xml -o coverage.lcov
Programmatic
use Laxit\CloverToLcov\Converter; $converter = new Converter(); // Convert and get LCOV string $lcov = $converter->convert('coverage/clover.xml'); // Convert and save to file $converter->convertAndSave('coverage/clover.xml', 'coverage.lcov'); // Convert from XML string directly $lcov = $converter->convertFromString($cloverXmlContent);
CI Integration
GitHub Actions
- name: Run tests with coverage run: vendor/bin/phpunit --coverage-clover coverage/clover.xml - name: Convert to LCOV run: vendor/bin/clover-to-lcov coverage/clover.xml -o coverage/lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: files: coverage/lcov.info
GitLab CI
test: script: - vendor/bin/phpunit --coverage-clover coverage/clover.xml - vendor/bin/clover-to-lcov coverage/clover.xml -o coverage/lcov.info artifacts: reports: coverage_report: coverage_format: cobertura path: coverage/lcov.info
LCOV Output Format
The generated LCOV file follows the standard format:
TN:
SF:/path/to/File.php
FNDA:5,methodName
FNF:1
FNH:1
DA:10,1
DA:11,5
DA:12,0
LF:3
LH:2
end_of_record
| Tag | Description |
|---|---|
TN |
Test name |
SF |
Source file path |
FNDA |
Function hit count |
FNF |
Functions found |
FNH |
Functions hit |
DA |
Line hit data |
LF |
Lines found |
LH |
Lines hit |
Requirements
- PHP ^8.1
- ext-simplexml
License
MIT
Part of the Laxit Artifact Collection
๐ Verdant Cloverstone ยท
๐ Mnemonic Sigil
