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

v1.0.1 2026-01-10 17:20 UTC

This package is auto-updated.

Last update: 2026-01-10 17:23:26 UTC


README

Breaking Change Radar for PHP โ€“ detect silent breaking changes in your code, APIs, and public methods before they hit production.

BreakRadar PHP License

๐Ÿš€ 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

  1. Public method removal

    public function legacy(): void {}

    If removed in a PR โ†’ BreakRadar fails CI

  2. Method signature change

    // Before
    public function create(string $name): void {}
    // After
    public function create(string $name, bool $force): void {}

    Detected and flagged

  3. API or service integration

    • Any internal or external consumer using your PHP classes
    • Prevents silent runtime bugs before deployment
  4. 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/main or origin/master)
  • Will snapshot current branch
  • Will compare and report breaking changes
  • Exit code = 1 if 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. ๐Ÿšจ