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

Backward Compatibility Check Laravel Package

roave/backward-compatibility-check

Checks your PHP library for backward compatibility breaks between git tags/versions. Designed for CI: compares the last SemVer tag to current HEAD, reports API breaks, and exits non-zero on failure. Install via Composer or run in Docker.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Strengths:

    • Semantic Versioning Alignment: Perfectly aligns with Laravel’s adherence to SemVer (e.g., 1.x.x for minor releases, 2.x.x for major). Enforces backward compatibility (BC) checks before releases, reducing post-release churn.
    • PHP-Centric: Built for PHP/Laravel ecosystems, leveraging composer.json autoloading and Git tags—native to Laravel’s workflow.
    • Granularity: Detects BC breaks at the class/method/property level (e.g., parameter changes, visibility modifications, removed methods), critical for Laravel’s layered architecture (e.g., Eloquent, Facades, Service Providers).
    • Integration with CI/CD: Designed for CI pipelines (e.g., GitHub Actions), complementing Laravel’s phpunit/pest testing suites.
  • Gaps:

    • No Laravel-Specific Rules: Lacks Laravel-specific BC checks (e.g., Facade method removals, Event/Listener contract changes). Requires manual configuration or extension.
    • Static Analysis Limitation: Cannot detect runtime BC breaks (e.g., dependency injection changes, dynamic method calls via call_user_func).

Integration Feasibility

  • Low-Friction Setup:

    • Composer Integration: Single composer require --dev command; no Laravel service provider or config file needed.
    • Git Dependency: Requires Git tags (SemVer-compliant), which Laravel projects already use for versioning.
    • Autoload Compatibility: Works with Laravel’s composer.json autoload paths (e.g., psr-4, classmap).
  • CI/CD Plug-and-Play:

    • GitHub Actions: Pre-built action (nyholm/roave-bc-check-ga) reduces setup time to <5 minutes.
    • Output Formats: Supports github-actions, markdown, and json for integration with Slack/Teams or changelog generation.

Technical Risk

  • False Positives/Negatives:
    • Risk: Laravel’s dynamic features (e.g., dynamic Facades, magic methods like handle() in Jobs) may trigger false BC alerts.
    • Mitigation: Use .roave-backward-compatibility-check.xml to whitelist known non-breaking changes (e.g., ignored-regex for Facade method additions).
  • Performance Overhead:
    • Risk: Full API scans on large codebases (e.g., Laravel + custom packages) may slow CI pipelines.
    • Mitigation: Run in parallel with other tests or cache results (e.g., GitHub Actions artifact caching).
  • PHP Version Support:
    • Risk: Laravel 10+ uses PHP 8.2+; package supports PHP 8.3+ (as of v8.20.0). Minor version lag may require dependency updates.
    • Mitigation: Monitor Roave’s release notes for PHP 8.3+ support.

Key Questions

  1. Laravel-Specific BC Needs:
    • Does the team need to enforce BC for Facades, Service Container bindings, or Event contracts? If yes, custom rules or post-processing may be required.
  2. CI Pipeline Impact:
    • How will this interact with existing tests? Should it block merges (strict) or warn only (lenient)?
  3. False Positive Handling:
    • What’s the process for approving ignored BC changes (e.g., via PR comments or a dedicated config file)?
  4. Monorepo Support:
    • If using a monorepo (e.g., Laravel + custom packages), how will Git tags and composer.json autoload paths be structured?
  5. Performance Baseline:
    • What’s the acceptable runtime for BC checks in CI? Will incremental analysis (e.g., only changed files) be needed?

Integration Approach

Stack Fit

  • Native Laravel Compatibility:
    • Composer: Zero conflicts with Laravel’s dependency manager.
    • Git: Leverages Laravel’s existing Git workflow (tags, branches).
    • PHP: Supports PHP 8.1+ (Laravel 9+) and 8.3+ (Laravel 10+), with minimal version lag.
  • Toolchain Synergy:
    • CI/CD: Integrates seamlessly with GitHub Actions, GitLab CI, or CircleCI.
    • Testing: Can run post-test (after phpunit) or pre-deploy (before tagging).
    • Documentation: Outputs markdown/json for changelogs (e.g., Laravel’s release notes).

Migration Path

  1. Pilot Phase:
    • Add to composer.json dev dependencies:
      composer require --dev roave/backward-compatibility-check
      
    • Test locally with a sample BC break (e.g., remove a deprecated method) to validate alerts.
  2. CI Integration:
    • Add to GitHub Actions (example below) after tests but before deployment:
      jobs:
        bc-check:
          runs-on: ubuntu-latest
          steps:
            - uses: actions/checkout@v4
              with:
                fetch-depth: 0  # Critical for tag detection
            - run: composer install
            - run: vendor/bin/roave-backward-compatibility-check --format=github-actions
      
  3. Gradual Enforcement:
    • Start with warnings only (non-zero exit code but not blocking).
    • Transition to blocking after 2–4 weeks (allowing teams to adapt).

Compatibility

  • Laravel-Specific Considerations:
    • Facades: May trigger false positives for dynamic method calls. Use ignored-regex to exclude:
      <ignored-regex>#\[BC\] CHANGED: The method Illuminate\\Support\\Facades\\Config::get\(\)#</ignored-regex>
      
    • Service Container: Changes to bindings (e.g., App\Services\*) may need manual review.
    • Events/Listeners: Contract changes (e.g., adding parameters to handle()) require explicit handling.
  • Third-Party Packages:
    • If Laravel uses custom packages, ensure their composer.json autoload paths are included in the global autoload section.

Sequencing

Phase Action Tools/Artifacts
Pre-Release Run BC check after phpunit but before tagging. GitHub Actions, roave-backward-compatibility-check
Post-Merge Use --format=github-actions to annotate PRs with BC warnings. GitHub PR comments
Release Generate markdown output for changelogs. results.md → Laravel’s release notes
Maintenance Periodically review ignored BC changes in .roave-backward-compatibility-check.xml. Config file, team syncs

Operational Impact

Maintenance

  • Configuration Drift:
    • Risk: .roave-backward-compatibility-check.xml may accumulate ignored rules, reducing effectiveness.
    • Mitigation:
      • Enforce a quarterly review of ignored rules (e.g., via a team meeting).
      • Use regex patterns sparingly; prefer baseline tags (v8.11.0+) for known-safe changes.
  • Dependency Updates:
    • Risk: Roave’s PHP version support may lag Laravel’s (e.g., PHP 8.3 in Laravel 10 vs. Roave’s PHP 8.3+ in v8.20.0).
    • Mitigation:
      • Pin to a specific minor version (e.g., 8.21.0) in composer.json.
      • Monitor Roave’s GitHub for PHP 8.4+ support.

Support

  • Troubleshooting:
  • Team Adoption:
    • Training: Conduct a 30-minute workshop on:
      • How to read BC error messages (e.g., [BC] REMOVED: Method App\Models\User::oldMethod()).
      • When to ignore vs. fix a BC break (e.g., deprecated methods vs. critical API changes).

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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata