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 Enforcement: Aligns perfectly with Laravel’s adherence to semantic versioning (SemVer) for releases, ensuring backward compatibility (BC) is explicitly validated before minor/patch releases.
    • Git-Centric Design: Leverages Git tags (SemVer-compliant) to compare revisions, which is native to Laravel’s monorepo or modular package structures (e.g., laravel/framework).
    • Composer Integration: Works seamlessly with Laravel’s composer.json autoload paths, requiring no additional configuration for most projects.
    • Output Flexibility: Supports CI-friendly formats (GitHub Actions, JSON, Markdown), enabling integration with Laravel’s existing CI/CD pipelines (GitHub Actions, GitLab CI, etc.).
    • Baseline Ignores: Allows whitelisting intentional BC changes via .roave-backward-compatibility-check.xml, useful for Laravel’s evolving APIs (e.g., deprecations in Illuminate\Support\Facades).
  • Gaps:

    • No Native Laravel API Awareness: Does not understand Laravel-specific patterns (e.g., Facades, Service Providers, or dynamic method resolution via __callStatic). May flag false positives for Laravel’s magic methods (e.g., Facade::__callStatic).
    • No Database Migration Checks: Ignores BC risks in database schema migrations (e.g., column renames, type changes), which are critical in Laravel.
    • Limited Framework-Specific Rules: Lacks Laravel’s custom BC rules (e.g., allowing protectedprivate in abstract classes, which Laravel often uses).

Integration Feasibility

  • High for Package Repositories:
    • Ideal for Laravel’s core framework (laravel/framework) or official packages (e.g., laravel/valet, laravel/horizon) where BC is critical.
    • Moderate for User Packages:
      • Requires manual setup for custom packages (Git tags, composer.json autoload).
      • May need custom rules for Laravel-specific patterns (e.g., Facades, dynamic properties).
  • CI/CD Readiness:
    • Zero-config integration with GitHub Actions (via nyholm/roave-bc-check-ga), reducing ramp-up time.
    • Works with Laravel’s existing PHP versions (8.0+; supports PHP 8.5 as of v8.16.0).

Technical Risk

  • Low for Core Teams:
    • Minimal risk for teams already using Git tags and SemVer (e.g., Laravel core).
    • False positives can be mitigated via baseline ignores or custom rules.
  • Medium for Custom Packages:
    • Risk of missing Laravel-specific BC patterns (e.g., Facade method changes).
    • Requires validation against Laravel’s internal BC tests (e.g., phpunit tests in laravel/framework).
  • Dependencies:
    • Relies on nikic/php-parser (v5.4+), which is stable but may introduce parsing quirks for Laravel’s dynamic code (e.g., __call, __get).

Key Questions

  1. Laravel-Specific BC Patterns:
    • How will this handle Laravel’s Facades (e.g., Route::get()Route::post())?
    • Can it ignore BC changes in Illuminate\Support\Traits (e.g., HasFactory)?
  2. Database Schema BC:
    • Should this be extended to check migration files (e.g., database/migrations) for BC risks?
  3. Performance Overhead:
    • What’s the runtime impact of parsing Laravel’s entire codebase (e.g., laravel/framework) in CI?
  4. Custom Rules:
    • Can rules be added to ignore Laravel’s internal deprecations (e.g., Str::camel()Str::camelCase())?
  5. Monorepo Support:
    • How does this handle BC checks across multiple Laravel packages in a monorepo (e.g., laravel/scout, laravel/fortify)?

Integration Approach

Stack Fit

  • PHP/Laravel Ecosystem:
    • Native Fit: Works with Laravel’s Composer-based dependency management and Git workflow.
    • CI/CD: Integrates with GitHub Actions, GitLab CI, or CircleCI out-of-the-box.
    • PHP Versions: Supports Laravel’s PHP 8.0+ stack (tested up to PHP 8.5).
  • Tooling Compatibility:
    • Static Analysis: Complements Laravel’s existing tools (PHPStan, Psalm, Pest) without redundancy.
    • Git Hooks: Can be added as a pre-push or pre-release hook for local validation.
    • IDE Support: Output formats (JSON, Markdown) enable IDE integration (e.g., PHPStorm annotations).

Migration Path

  1. Phase 1: Core Framework (laravel/framework)
    • Add to CI pipeline (GitHub Actions) with baseline ignores for known BC changes.
    • Validate against Laravel’s existing BC tests (e.g., tests/BC/).
  2. Phase 2: Official Packages
    • Roll out to laravel/valet, laravel/horizon, etc., with package-specific rules.
  3. Phase 3: Community Packages
    • Publish a Laravel-specific guide for custom rules (e.g., Facade handling).
    • Offer a template .roave-backward-compatibility-check.xml for Laravel projects.

Compatibility

  • Laravel Versions:
    • Works with Laravel 8+ (PHP 8.0+) and Laravel 9/10 (PHP 8.1+).
    • PHP 8.5 support (v8.16.0+) aligns with Laravel’s future roadmap.
  • Customization:
    • Extendable via XML config (e.g., ignore Illuminate\Contracts changes).
    • Can be wrapped in a Laravel Artisan command for local devs.
  • False Positives:
    • Laravel’s dynamic methods (e.g., __call, __get) may trigger false positives. Mitigate via:
      • Regex ignores in .roave-backward-compatibility-check.xml.
      • Custom PHPStan/Psalm rules to pre-filter changes.

Sequencing

  1. Pre-Commit Hooks (Optional):
    • Local validation for developers (e.g., composer test:bc).
  2. CI Pipeline (Mandatory):
    • Run on push to main/develop branches (GitHub Actions example provided).
    • Fail builds on BC breaks (enforce SemVer compliance).
  3. Release Process:
    • Final BC check before tagging a new minor/patch version.
    • Generate changelog-friendly output (--format=markdown).

Operational Impact

Maintenance

  • Low Ongoing Effort:
    • Minimal maintenance after initial setup (updates via Composer).
    • Configuration updates only needed for intentional BC changes.
  • Dependency Updates:
    • Automated via Renovate (as seen in the package’s PRs).
    • PHP version support drops (e.g., PHP 8.2 in v8.15.0) may require Laravel stack updates.

Support

  • Developer Onboarding:
    • Requires education on SemVer and BC principles for new contributors.
    • Document common false positives (e.g., Facade changes).
  • Troubleshooting:
    • Debugging false positives may require PHP parsing expertise.
    • Laravel-specific issues may need escalation to Roave or Laravel core teams.

Scaling

  • Performance:
    • Parsing large codebases (e.g., laravel/framework) may slow CI pipelines.
    • Mitigate via:
      • Caching parsed results (e.g., store in vendor/).
      • Parallel execution (if supported in future versions).
  • Monorepos:
    • Scales poorly across unrelated packages without customization.
    • Solution: Run per-package or use a monorepo-aware wrapper.

Failure Modes

  • False Positives:
    • Laravel’s dynamic features (Facades, __call) may trigger unnecessary failures.
    • Mitigation: Extensive baseline ignores or custom rules.
  • False Negatives:
    • May miss BC risks in database migrations or config files.
    • Mitigation: Supplement with custom scripts or tools like laravel-shift/database.
  • CI Flakiness:
    • Git tag fetching issues (e.g., shallow clones) can break the tool.
    • Mitigation: Use fetch-depth: 0 in CI (as documented).

Ramp-Up

  • Time to Value:
    • 1–2 hours for core teams (GitHub Actions setup + baseline config).
    • 1–3 days for custom packages (rule tuning + CI integration).
  • Key Milestones:
    1. Add to composer.json (--dev).
    2. Configure GitHub Actions with fetch-depth: 0.
    3. Define baseline ignores for known BC changes.
    4. Test against a minor release to validate output.
  • Training Needs:
    • SemVer refresher for teams unfamiliar with BC concepts.
    • Workshop on interpreting BC check output (e.g., diff formats).
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai