shipmonk/coverage-guard
Enforce code coverage in your CI. Not by percentage, but target core methods. No more untested Facades, Controllers, or Repositories. Allows you to start enforcing coverage for new code only!
1.1.0
118K downloads/mo
#2777 most downloaded on Packagist
shipmonk-rnd/coverage-guard
What this package is like to depend on
Last release 1 months ago
17 Jul 2026
Release timing varies
gaps range from 4 weeks to 6 months
Nearly every release is documented
notes for 4 of 4 stable releases
Nothing withdrawn
no release was ever pulled
8 months old
4 releases · first in 2025
4 releases in the last 12 months
see the full history below
Release timeline
4 releases · Dec 2025 to Jul 2026Releases
latest 4-
1.1.017 Jul 2026Release notes
Open source →New features:
- Executable line excluders: exclude lines you don't want to enforce coverage for (#67)
- register via
Config::addExecutableLineExcluder() - prepared
IgnoreThrowNewExceptionLineExcluderallows excluding e.g. allthrow new LogicException(...)lines - honored by both
checkandpatch-coveragecommands - excluded lines are rendered with gray background in
checkoutput
- register via
// coverage-guard.php use ShipMonk\CoverageGuard\Config; use ShipMonk\CoverageGuard\Excluder\IgnoreThrowNewExceptionLineExcluder; $config = new Config(); $config->addExecutableLineExcluder(new IgnoreThrowNewExceptionLineExcluder([ LogicException::class, ])); return $config;
Fixes:
- Executable line excluders: exclude lines you don't want to enforce coverage for (#67)
-
1.0.202 Jan 2026 -
1.0.110 Dec 2025 -
1.0.008 Dec 2025Release notes
Open source →Initial release
- Enforce code coverage in your CI by targetting core methods (not by percentage)
- Supports all PHPUnit coverage formats
- Supports all PHPUnit versions
- Fully customizable
- PHP 8.1+
Example config:
// coverage-guard.php use ShipMonk\CoverageGuard\Config; use ShipMonk\CoverageGuard\Rule\EnforceCoverageForMethodsRule; $config = new Config(); $config->addRule(new EnforceCoverageForMethodsRule( requiredCoveragePercentage: 50, minExecutableLines: 5, )); return $config;
Example run:
# Run tests, collect coverage, generate report: XDEBUG_MODE=coverage vendor/bin/phpunit tests --coverage-filter src --coverage-clover clover.xml # Verify coverage: vendor/bin/coverage-guard check clover.xml