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

Clobber Laravel Package

pcov/clobber

Clobber PHPUnit 5–7’s Xdebug code coverage driver to use PCOV instead. Install with composer and run vendor/bin/pcov clobber or unclobber (optionally targeting another directory). Useful when upgrading to PHPUnit 8 isn’t feasible.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Purpose Alignment: The pcov/clobber package provides a targeted workaround for PHPUnit 5/6/7 users who require PCOV support but cannot upgrade due to strict type system constraints or legacy dependencies. It aligns with Laravel projects still using older PHPUnit versions (e.g., Laravel 5.x–7.x) where migration to PHPUnit 8+ is blocked by void return type issues or third-party constraints.
  • Laravel Relevance: Laravel’s testing ecosystem (e.g., phpunit.xml, TestCase classes) is compatible with this package, as it operates at the PHPUnit layer rather than the framework layer. It is particularly useful for:
    • Legacy Laravel applications (pre-8.x) with PHPUnit 5/6/7.
    • CI/CD pipelines where Xdebug conflicts with PCOV requirements.
    • Teams incrementally migrating to PHPUnit 8+ but needing PCOV for coverage reports during the transition.
  • Alternatives: Native PCOV support in PHPUnit 8+ or Xdebug 3+ eliminates the need for this package, but it remains a viable stopgap for constrained environments.

Integration Feasibility

  • Low Coupling: The package is CLI-driven and does not require Laravel-specific modifications. Integration involves:
    1. Adding pcov/clobber as a dev dependency.
    2. Running vendor/bin/pcov clobber pre-test (e.g., in CI scripts or phpunit.xml).
    3. Reverting with vendor/bin/pcov unclobber post-test if needed.
  • No Core Modifications: No changes to Laravel’s service container, facades, or config files are required. It operates transparently at the PHPUnit layer.
  • Dependency Conflicts:
    • Risk of conflicts with:
      • PHPUnit 8+ or tools that assume Xdebug’s default behavior.
      • Custom PHPUnit bootstrap files or test listeners.
      • Other PCOV/Xdebug tools (e.g., phpunit/phpunit ≥8.0, theseer/tokenizer).
    • Mitigation: Test in a staging environment and pin the package version in composer.json.

Technical Risk

Risk Area Severity Mitigation Strategy
Breakage with PHPUnit 8+ Low Explicitly document as a legacy-only tool.
Xdebug Version Incompatibility Medium Test with target Xdebug versions (2.9–3.2).
CI/CD Pipeline Failures High Add pcov clobber to pre-test hooks; monitor coverage reports.
False Positives in Coverage Medium Validate coverage accuracy post-integration.
Lack of Active Maintenance Medium Fork or patch if issues arise (MIT license).
State Corruption High Backup original Xdebug configs; test rollback.

Key Questions

  1. Why can’t we upgrade PHPUnit?
    • Audit dependencies for void/type system blockers (e.g., laravel/framework <8.0, custom test suites).
    • Estimate migration effort vs. short-term gain from pcov/clobber.
  2. How will this affect coverage reports?
    • Benchmark PCOV vs. Xdebug accuracy in a staging environment (e.g., compare phpunit --coverage-text outputs).
  3. CI/CD Impact:
    • Will pcov clobber slow down test suites? (Profile locally with time vendor/bin/phpunit.)
    • How to handle failures if clobbering/unclobbering corrupts state? (Add error handling in scripts.)
  4. Long-Term Strategy:
    • Is this a temporary fix or a permanent workaround?
    • Plan for PHPUnit 8+ migration (e.g., quarterly audits, deprecation timeline).
  5. Xdebug Dependency:
    • Is Xdebug installed and enabled in all target environments (local, CI, staging)?
    • What versions of Xdebug are used? (Package targets 2.9–3.2.)
  6. Laravel-Specific Risks:
    • Are there custom test listeners or PHPUnit extensions that might conflict?
    • Does the project use parallel testing (e.g., phpunit --parallel)? (Clobbering may cause race conditions.)

Integration Approach

Stack Fit

  • Compatibility:
    • PHP: 5.6–7.4 (PHPUnit 5–7 support).
    • Laravel: 5.8–8.x (earlier versions may require PHPUnit 5.x).
    • Xdebug: 2.9–3.2 (package targets these versions explicitly).
    • PHPUnit: 5.0–7.5.20 (avoid ≥8.0).
  • Toolchain Synergy:
    • Works with Laravel’s default phpunit.xml or custom configurations.
    • Complements tools like laravel/testbench or phpunit-db-unit if they rely on legacy PHPUnit.
  • Anti-Patterns:
    • Avoid using in projects with custom Xdebug extensions or PCOV forks.
    • Not suitable for PHP 8.0+ (native PCOV support) or Xdebug 3+ (native PCOV compatibility).

Migration Path

  1. Assessment Phase:
    • Run composer why-not phpunit/phpunit:^8.0 to identify blockers.
    • Test pcov/clobber in a staging branch with a subset of tests.
  2. Integration Steps:
    composer require --dev pcov/clobber
    vendor/bin/pcov clobber  # Add to pre-test script (e.g., in package.json or CI)
    
    • Modify phpunit.xml to enforce PCOV:
      <php>
          <env name="PHPUNIT_USE_PCOV" value="1"/>
          <env name="XDEBUG_MODE" value="off"/> <!-- Disable Xdebug -->
      </php>
      
  3. Validation:
    • Compare coverage reports (phpunit --coverage-text) before/after.
    • Test edge cases: parallel tests, custom test listeners, and Laravel-specific test suites (e.g., FeatureTestCase).
  4. Rollback Plan:
    • Script pcov unclobber in post-test hooks.
    • Maintain a backup of original Xdebug configs (e.g., xdebug.ini).
    • Document the process in CONTRIBUTING.md.

Compatibility Matrix

Component Version Range Notes
Laravel 5.8–8.x PHPUnit 5–7.x compatible.
PHPUnit 5.0–7.5.20 Avoid ≥8.0.
PHP 5.6–7.4 PHP 8.0+ unsupported.
Xdebug 2.9–3.2 Package targets these versions.
PCOV 1.0.0–2.0.0 Ensure no conflicts with other PCOV tools.
Laravel Testbench 3.x–4.x May require additional configuration.

Sequencing

  1. Pre-requisite: Verify Xdebug is installed (php -m | grep xdebug).
  2. Order of Operations:
    • Pre-test: pcov clobber → Run PHPUnit → pcov unclobber.
    • CI: Add to before_script (GitHub Actions) or before_all (Jenkins).
    • Local: Use a Makefile or composer script for convenience:
      {
        "scripts": {
          "test:coverage": "pcov clobber && phpunit --coverage-clover=coverage.xml && pcov unclobber"
        }
      }
      
  3. Parallel Testing: Not recommended (race conditions on Xdebug driver).
    • If parallel testing is required, use --group flags instead.

Operational Impact

Maintenance

  • Dependency Management:
    • Pin the package version in composer.json (e.g., "pcov/clobber": "1.0.0").
    • Monitor for updates (though unlikely; project is dormant).
  • Documentation:
    • Add to README.md or Testing.md:
      ## Legacy PCOV Support
      This project uses `pcov/clobber` for PHPUnit <8.0 compatibility.
      Run `vendor/bin/pcov clobber` before tests; see [pcov-clobber](https://github.com/krakjoe/pcov-clobber) for details.
      
    • Include a deprecation notice (e.g., "Remove after PHPUnit 8+ migration").
  • Upgrade Path:
    • Set a **deprec
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.
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php
trappistes/laravel-custom-fields
splash/sonata-admin
splash/metadata