roave/backward-compatibility-check
CLI tool to detect backward-compatibility breaks between two versions of a PHP library. Compares the last SemVer git tag to current HEAD (or chosen refs) and fails CI on API breaks. Install via Composer or run with Docker.
composer.json autoloading.v1.0.0): Laravel already uses this for releases.composer.json already defines autoload paths.| Risk Area | Assessment | Mitigation |
|---|---|---|
| False Positives | The tool may flag intentional API changes (e.g., deprecations, internal methods) as BC breaks. Laravel’s codebase has internal classes/methods (e.g., Illuminate\Support\Traits) that should be excluded. |
Use .roave-backward-compatibility-check.xml to ignore known BC-safe changes (e.g., internal methods, @internal annotations). |
| Performance Overhead | Static analysis of large codebases (e.g., Laravel + packages) may slow down CI. | Run in parallel with other CI jobs or cache results (e.g., GitHub Actions artifact caching). Use --format=json for machine-readable output to avoid reprocessing. |
| Enum/Attribute Support | Laravel 10+ uses enums and attributes; the package supports enum changes (v8.8.0+) but may miss edge cases (e.g., custom attributes). | Test with Laravel’s enum-heavy packages (e.g., spatie/laravel-permission) to validate coverage. |
| CI Configuration Complexity | Requires full Git history (fetch-depth: 0) and tag fetching, which may not be enabled in all Laravel CI setups. |
Document CI setup requirements in Laravel’s README.md or .github/workflows/. Use the Nyholm GitHub Action for simplicity. |
| Dependency Conflicts | The package depends on nikic/php-parser:^5.4 and vimeo/psalm:^6, which may conflict with Laravel’s dependencies (e.g., older PHP versions). |
Pin versions in composer.json or use --dev isolation. Test with Laravel’s minimum supported PHP version. |
roave-backward-compatibility-check.xml)?@deprecated annotations) or migration system (e.g., flagging BC breaks in Illuminate\Database schema changes)?Laravel Core:
illuminate/, laravel/), and official addons (e.g., spatie/laravel-*).Illuminate\Container).Illuminate\Database).Illuminate\Http).Illuminate\Queue, Illuminate\Events).laravel-excel) or third-party integrations (e.g., tightenco/ziggy), where BC is managed by package maintainers.Laravel Ecosystem:
mix.js() API changes).| Phase | Action | Tools/Artifacts |
|---|---|---|
| Pilot (Core Team) | 1. Add to Laravel’s CI: Integrate into laravel/framework’s GitHub Actions. |
.github/workflows/backward-compatibility.yml, composer.json (dev dependency). |
2. Baseline Configuration: Create .roave-backward-compatibility-check.xml to ignore known BC-safe changes (e.g., internal methods, @internal classes). |
roave-backward-compatibility-check.xml (initial version). |
|
3. Test with Major Releases: Run against LTS branches (e.g., 10.x, 9.x) to validate false positives/negatives. |
Git tags (v10.0.0, v9.50.0). |
|
| Rollout (Ecosystem) | 4. Document for Packages: Publish a Laravel-specific guide on how to adopt the tool. | Laravel Docs (laravel.com/docs/extending/backward-compatibility). |
| 5. GitHub Action Template: Provide a pre-configured action for Laravel packages. | Fork of Nyholm’s action with Laravel defaults. | |
| Optimization | 6. Performance Tuning: Cache results in CI, parallelize runs. | GitHub Actions cache, concurrently for local dev. |
7. Ignore List Automation: Explore bot-driven updates to the ignore list (e.g., via PRs for new @internal annotations). |
GitHub App or Laravel’s laravel-shift bot. |
roave/backward-compatibility-check:^8.0).How can I help you explore Laravel packages today?