PHPackages                             schemaguard/laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. schemaguard/laravel

ActiveLibrary[Database &amp; ORM](/categories/database)

schemaguard/laravel
===================

A deployment firewall for database schema changes. Blocks destructive Laravel migrations before they reach production.

v0.1.0(1mo ago)00MITPHPPHP ^8.2

Since Jul 4Pushed 1mo agoCompare

[ Source](https://github.com/MohamedAhmed479/schemaguard-laravel)[ Packagist](https://packagist.org/packages/schemaguard/laravel)[ RSS](/packages/schemaguard-laravel/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

SchemaGuard for Laravel
=======================

[](#schemaguard-for-laravel)

SchemaGuard is a deployment firewall for database schema changes in Laravel applications.

It statically analyzes pending, explicit, or Git-diff migration files, maps destructive schema changes to Laravel code usage, and returns a CI-friendly decision: `SAFE`, `WARNING`, or `BLOCK`.

Installation
------------

[](#installation)

Requirements:

- PHP `^8.2`
- Laravel components compatible with Laravel 11 or 12

```
composer require schemaguard/laravel
```

Publish the configuration when you need to customize paths, policy modes, ignores, enforced symbols, or cache location:

```
php artisan vendor:publish --tag=schemaguard-config
```

Basic Usage
-----------

[](#basic-usage)

Analyze pending migrations and the configured application paths:

```
php artisan schemaguard:check
```

Analyze explicit migrations and source paths:

```
php artisan schemaguard:check \
  --migrations=database/migrations/2026_07_03_000000_drop_phone_from_users.php \
  --path=app
```

Analyze migrations added or modified relative to a Git base:

```
php artisan schemaguard:check --diff --base=origin/main
```

Emit JSON for automation:

```
php artisan schemaguard:check --diff --base=origin/main --format=json
```

Useful options:

OptionPurpose`--path=*`Override configured source paths to scan.`--migrations=*`Analyze explicit migration files.`--diff`Analyze added/modified migrations from local Git diff.`--base=HEAD`Git base ref used with `--diff`.`--format=console|json`Choose human console output or machine JSON.`--strict`Treat warnings as CI failures.`--no-cache`Bypass SchemaGuard's optional AST cache reads and writes.Caught Before Merge
-------------------

[](#caught-before-merge)

If a migration drops a used column:

```
Schema::table('users', function (Blueprint $table): void {
    $table->dropColumn('phone');
});
```

and application code still reads `users.phone`, SchemaGuard reports `BLOCK` and exits `1`:

```
BLOCK COLUMN_DROPPED users.phone
RESULT: BLOCK

```

### See it in action

[](#see-it-in-action)

[![SchemaGuard blocks a used column drop](docs/demo/blocking-a-used-column-drop.svg)](docs/demo/blocking-a-used-column-drop.svg)

SchemaGuard detects that `users.email` is still used by the application and blocks the destructive migration before deployment.

Decisions and Exit Codes
------------------------

[](#decisions-and-exit-codes)

ResultMeaningDefault exit code`SAFE`No matching usage evidence was found, or the change is explicitly ignored/neutralized.`0``WARNING`Risk is ambiguous or intentionally non-blocking, such as used type changes by default.configured, default `0``BLOCK`High-confidence usage evidence or enforced policy says the change should not ship.`1`Use `--strict` to make warnings fail CI:

```
php artisan schemaguard:check --diff --base=origin/main --strict
```

GitHub Actions
--------------

[](#github-actions)

```
- name: SchemaGuard
  run: php artisan schemaguard:check --diff --base=origin/main --strict
```

JSON Contract
-------------

[](#json-contract)

JSON mode writes only one JSON document to stdout. The payload includes:

```
schema_version
overall
counts
exit_code
analyzed
findings
diagnostics

```

`findings` include the migration event, target table/column, severity, usage evidence, confidence, source locations, impact paths, and neutralization/indeterminate flags where applicable.

Known Limitations
-----------------

[](#known-limitations)

- Type inference is conservative and intra-procedural.
- Raw SQL support uses token-boundary matching for static SQL strings, not a full SQL grammar.
- Raw SQL evidence is capped at `HIGH` confidence and never becomes `DEFINITIVE`.
- Dynamic SQL is reported as an indeterminate diagnostic instead of guessed.
- SchemaGuard never executes host migrations, models, controllers, resources, routes, or database queries.
- Phase 1 does not include a hosted PR review service, GitHub App, SaaS dashboard, multi-repository orchestration, or non-Laravel parsers.

License
-------

[](#license)

SchemaGuard is open-sourced software licensed under the MIT license.

###  Health Score

34

—

LowBetter than 74% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

48d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/160210223?v=4)[MohamedAhmedDev](/maintainers/MohamedAhmed479)[@MohamedAhmed479](https://github.com/MohamedAhmed479)

---

Top Contributors

[![MohamedAhmed479](https://avatars.githubusercontent.com/u/160210223?v=4)](https://github.com/MohamedAhmed479 "MohamedAhmed479 (15 commits)")

---

Tags

cicomposer-packagedatabasedeployment-safetydevtoolslaravelmigrationsphpschemastatic-analysislaravelschemastatic analysisdatabasemigrationscideployment-safety

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/schemaguard-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/schemaguard-laravel/health.svg)](https://phpackages.com/packages/schemaguard-laravel)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M331](/packages/laravel-ai)[spatie/laravel-backup

A Laravel package to backup your application

6.0k25.4M272](/packages/spatie-laravel-backup)[illuminate/queue

The Illuminate Queue package.

20433.0M1.8k](/packages/illuminate-queue)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[erag/laravel-lang-sync-inertia

A powerful Laravel package for syncing and managing language translations across backend and Inertia.js (Vue/React/Svelte) frontends, offering effortless localization, auto-sync features, and smooth multi-language support for modern Laravel applications.

5031.3k](/packages/erag-laravel-lang-sync-inertia)[laravel/surveyor

Static analysis tool for Laravel applications.

89157.7k16](/packages/laravel-surveyor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
