Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Php Coverage Badger

Php Coverage Badger Laravel Package

jaschilz/php-coverage-badger

Generate an SVG code coverage badge from a PHPUnit Clover XML report. Install via Composer and run the included CLI to turn clover.xml into a coverage.svg badge for your CI or README.

View on GitHub
Deep Wiki
Context7

Create a code coverage badge from a PHPUnit Clover XML file.

Frequently asked questions about Php Coverage Badger
Can I use this package directly in a Laravel project without modifying core files?
Yes, this package is a standalone CLI tool and doesn’t require Laravel-specific changes. You only need to generate a Clover XML file via PHPUnit (e.g., `phpunit --coverage-clover=clover.xml`) and run the badge generator afterward. It’s ideal for CI/CD workflows or local development.
What Laravel versions does this package support?
The package itself doesn’t depend on Laravel, but it works with any PHP project using PHPUnit. For Laravel 8.0+ (PHP 8+), you may need to fork and update the package since the last release was in 2017. Test compatibility or patch for modern PHP versions if required.
How do I integrate this into a Laravel CI pipeline (e.g., GitHub Actions)?
Add the badge generation step post-PHPUnit in your CI script. For GitHub Actions, use a step like `./vendor/bin/php-coverage-badger clover.xml public/coverage.svg` after running tests. You can then reference the SVG in your README or upload it to Shields.io via their API.
Does this package support custom badge colors or logos for branding?
The package uses hardcoded colors and styles, but you can post-process the generated SVG with tools like `svgo` or manually edit the template logic to match your branding. For dynamic colors, consider wrapping the CLI in a custom script or Laravel Artisan command.
Is there a Laravel-specific wrapper or Artisan command for this tool?
No official Laravel integration exists, but you can create a custom Artisan command (e.g., `php artisan coverage:badge`) to automate badge generation. This would handle paths, CLI execution, and even SVG hosting (e.g., uploading to Shields.io) within Laravel’s ecosystem.
What happens if PHPUnit’s Clover XML format changes in the future?
The package relies on PHPUnit’s Clover XML schema, which may evolve. To mitigate risks, validate the XML file in your CI pipeline (e.g., using `xmllint`) before badge generation. If the format breaks, you may need to fork the package or switch to an alternative like Codecov’s API.
Can I use this for internal Laravel dashboards or only public documentation?
The generated SVG badge can be embedded anywhere—public READMEs, internal dashboards (if your system supports SVG rendering), or even Laravel admin panels. It’s purely a visual representation of coverage data, so use it wherever you need to display metrics.
Are there alternatives to this package for Laravel projects?
Yes, consider using Shields.io’s API directly (via `curl` or a Laravel HTTP client) or services like Codecov, which offer pre-built coverage badges without manual XML processing. These alternatives may reduce maintenance overhead but offer less customization.
How do I test this package in a Laravel project before production use?
Start by installing it in a sandbox Laravel project (`composer require --dev jaschilz/php-coverage-badger`), generate a Clover XML file with PHPUnit, and run the badge generator. Verify the SVG output in your browser or README. For CI testing, mock the XML file and assert the SVG generation step.
What are the maintenance risks of using this unmaintained package?
The package hasn’t been updated since 2017, so you may encounter PHP 8+ compatibility issues or XML schema changes. Mitigate risks by forking the repo for minor fixes, wrapping it in a Laravel-specific script, or evaluating alternatives like Codecov for long-term reliability.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor