codeception/c3
C3 is Codeception’s remote code coverage helper for PHP apps. It collects coverage from web/functional tests by instrumenting your entry point and forwarding results back to the test runner, making it easy to measure coverage on remote servers and CI.
codeception/c3 package is a remote code coverage tool designed specifically for Codeception, a PHP testing framework. If the Laravel application already uses Codeception (or plans to adopt it), this package provides a native integration for distributed code coverage collection, which is critical for CI/CD pipelines, microservices, or large-scale applications.c3 enhances coverage reporting without requiring a full PHPUnit migration.c3 enables remote coverage collection (e.g., from Docker containers, Kubernetes pods, or parallel test runs), which is more efficient than local coverage tools like Xdebug for distributed environments._before, _after) and remote collection endpoints, making it non-intrusive to existing Laravel test suites.c3 supports PHP 7.4+, so backward compatibility is not an issue.c3 relies on Xdebug for coverage collection, which can slow down tests in CI. Mitigation: Use Xdebug 3+ with optimized settings (xdebug.mode=coverage).c3 + local coverage) may need custom scripting (e.g., using php-coveralls or clover-merger).c3 provides a scalable alternative for CI.c3.c3’s remote collection is a strong fit.composer require codeception/codeception codeception/c3
codeception.yml for remote coverage:
suites:
api:
actor: ApiTester
modules:
enabled:
- \Helper\Api
- \Codeception\Module\C3
php -S localhost:8080) or use a CI-provided endpoint (e.g., GitHub Actions artifact upload).C3 module config:
modules:
config:
C3:
endpoint: 'http://coverage-collector:8080/upload'
format: 'clover'
- name: Run tests with coverage
run: vendor/bin/codecept run --coverage --coverage-xml
- name: Upload coverage to C3
run: curl -X POST -F "file=@coverage.xml" http://coverage-collector/upload
clover-merger or php-coveralls to combine remote coverage with local reports.ApiTester aligns with Laravel’s HTTP client.c3 in a single CI job to validate coverage collection.c3 merges results correctly.c3-based reporting.xdebug.coverage_enable=1, xdebug.mode=coverage).c3 can be verbose; ensure proper logging in CI.c3 is niche—self-support may be needed for edge cases.ApiTester is configured correctly.xdebug.mode=coverage
xdebug.start_with_request=trigger # Only enable for test runs
| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Remote endpoint unreachable | Coverage data loss | Use CI-native storage (e.g., GitHub Actions artifacts). |
| Xdebug misconfiguration | No coverage collected | Validate xdebug settings in CI. |
| Parallel job race conditions | Corrupted merged coverage | Use unique filenames per job. |
| Codeception test failures | False negatives in coverage | Isolate coverage collection from test logic. |
| CI environment cleanup | Temporary files not persisted | Use persistent storage (e.g., S3). |
How can I help you explore Laravel packages today?