sbsaga / breakradar
Detect breaking changes between branches
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/sbsaga/breakradar
Requires
- php: >=8.1
- symfony/console: ^7.0
README
Breaking Change Radar for PHP โ detect silent breaking changes in your code, APIs, and public methods before they hit production.
๐ Overview
BreakRadar is a developer-focused CLI tool that automatically detects breaking changes between your base branch (usually main) and your feature/PR branch. It works even if all tests pass.
Problem it solves: developers accidentally remove methods, change signatures, or modify public APIs, breaking consumers silently. Normal CI/testing pipelines do not catch this.
BreakRadar answers the question:
"Did this PR break someone elseโs code?"
๐ก Key Features
- โ Detect removed public methods
- โ Detect changed method signatures
- โ Compare base branch vs PR branch automatically
- โ Fully CI-compatible (GitHub Actions)
- โ Git-robust: works with main, master, or any default branch
- โ Production-ready CLI
- โ JSON + human-readable output
- โ Extensible for API field diff, enums, configs in the future
๐ฏ Use Cases
-
Public method removal
public function legacy(): void {}
If removed in a PR โ BreakRadar fails CI
-
Method signature change
// Before public function create(string $name): void {} // After public function create(string $name, bool $force): void {}
Detected and flagged
-
API or service integration
- Any internal or external consumer using your PHP classes
- Prevents silent runtime bugs before deployment
-
Multi-branch / PR pipelines
- Detect breaking changes automatically on GitHub Actions
- Fail PRs before merging
๐ Installation
Composer:
composer require sbsaga/breakradar --dev
Optional: global install
composer global require sbsaga/breakradar
โก Usage
Local CLI
php bin/breakradar check
- Will snapshot base branch (
origin/mainororigin/master) - Will snapshot current branch
- Will compare and report breaking changes
- Exit code =
1if breaking changes found (CI-friendly)
GitHub Actions
Create .github/workflows/breakradar.yml:
name: BreakRadar on: pull_request: branches: [ main ] push: branches: [ main ] jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: shivammathur/setup-php@v3 with: php-version: '8.2' extensions: mbstring, json - run: composer install --no-interaction --prefer-dist - run: php bin/breakradar check
๐งฑ Project Structure
breakradar/
โโโ bin/
โ โโโ breakradar # CLI entry point
โโโ src/
โ โโโ Command/ # Symfony Console command
โ โโโ Analyzer/ # Git + Public API snapshot
โ โโโ Diff/ # Breaking change diff engine
โ โโโ Reporter/ # Human-readable reporting
โ โโโ Config/ # Config (future use)
โโโ action/
โ โโโ action.yml # GitHub Action config
โโโ tests/ # PHPUnit tests
โโโ composer.json
โโโ README.md
๐งช Example Workflow
Add a breaking change
public function legacy(): void {}
Run:
php bin/breakradar check
Output:
No breaking changes detected.
Remove the method
// Deleted legacy()
Run again:
Breaking changes detected:
- Public method removed: App\SomeClass::legacy
Exit code: 1 โ CI fails
๐ Why BreakRadar is Useful
- Prevents silent production bugs
- Forces better API discipline
- Saves debugging time
- Stack-agnostic โ works for any PHP backend
- Especially valuable for microservices, libraries, and shared packages
โ๏ธ Configuration
- Currently zero-config; snapshots stored in
.breakradar/ - Future configs possible:
- Ignore methods/classes
- Detect API JSON field changes
- Enum/constant validation
๐ Roadmap (v2+)
- API response field diff
- Config / ENV shape checks
- Event / Queue payload checks
- JSON artifact output for CI dashboards
- Automatic PR comments with detailed report
๐ License
MIT License โ feel free to fork, extend, or use in commercial projects.
๐จโ๐ป Author
sbsaga โ PHP backend developer
GitHub
๐ฆ Download
git clone https://github.com/sbsaga/breakradar.git
cd breakradar
composer install
php bin/breakradar check
BreakRadar: Stop silent breaking changes before they hit production. ๐จ