承接 laxit/clover-to-lcov 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

laxit/clover-to-lcov

Composer 安装命令:

composer require laxit/clover-to-lcov

包简介

Converts your Phpunit's Clover xml report to CI friendly LCOV report

README 文档

README

Verdant Cloverstone

💚 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

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-12