shipmonk/coverage-guard
Enforce code coverage in CI by targeting core functionality instead of percentages. Legacy-friendly and extensible, it lets you require coverage only for chosen methods and, with a patch, only for new code. Lightweight and easy to start.
--patch mode lets teams enforce coverage only on new or changed code. This supports a roadmap where legacy modules are improved incrementally while new work is held to a higher standard.nikic/php-parser) and MIT license reduce procurement friction.merge and convert support parallel test jobs and artifact normalization. This matters when product delivery depends on fast CI and reliable coverage reporting across shards.clover.xml. Phase 2: enforce new-code-only via --patch. Phase 3: add rules for critical components. Phase 4: ratchet legacy coverage where business risk justifies it.clover.xml.patch-coverage.For executives: This is a low-cost, MIT-licensed CI guardrail that lets us enforce test coverage where it matters—critical Laravel code and new changes—without demanding 100% coverage of legacy systems. It reduces regression risk, avoids custom coverage tooling, and supports incremental modernization. Start with a pilot enforcing coverage only on new/modified code, measure blocked PRs and escaped defects, then expand to critical modules. Key caveat: it is a small OSS package, so assign ownership and validate maintenance before making it a mandatory gate.
For engineering: Add it as a dev dependency, generate clover.xml in the Laravel/PHPUnit CI job, run coverage-guard init, and add coverage-guard check clover.xml --patch changes.patch to PR pipelines. Configure EnforceCoverageForMethodsRule with conservative thresholds, use path mapping for CI/local differences, and use merge for parallel jobs. Prefer clover for IDE/GitLab compatibility and avoid the PHP coverage format for large suites. Pilot on new code first, tune minExecutableLines and percentage thresholds, and explicitly validate behavior around Laravel dynamic methods, generated code, and exclusions before expanding enforcement.
How can I help you explore Laravel packages today?