PHPackages                             xnoire666/db-diff - 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. xnoire666/db-diff

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

xnoire666/db-diff
=================

Laravel artisan command that diffs two MySQL databases and generates SQL files for the missing tables, views, columns, and mismatched column properties.

v0.1.0(2mo ago)00MITPHPPHP ^8.0CI passing

Since May 18Pushed 2mo agoCompare

[ Source](https://github.com/xnoire666/db-diff)[ Packagist](https://packagist.org/packages/xnoire666/db-diff)[ RSS](/packages/xnoire666-db-diff/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

xnoire666/db-diff
=================

[](#xnoire666db-diff)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5a2e6922a39579f39b8afcbbf4b46a3c6f6e499bd150ad315a5a3d2aa9a678a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f786e6f6972653636362f64622d646966662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xnoire666/db-diff)[![Tests](https://camo.githubusercontent.com/4f420390519f43adaf4107db54bde83314b753d8269bd3ad57494eafcdf6f087/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f786e6f6972653636362f64622d646966662f74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/xnoire666/db-diff/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/8c5854f97749b82a4c7656560e899ce392338b2f1b3ae628f88863ab0a7ee704/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f786e6f6972653636362f64622d646966662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xnoire666/db-diff)[![License](https://camo.githubusercontent.com/e44727d97f337115721df84eac73dc3c064414c34f413c01f6316999c8e3c7e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f786e6f6972653636362f64622d646966662e7376673f7374796c653d666c61742d7371756172652663616368655365636f6e64733d333030)](https://packagist.org/packages/xnoire666/db-diff)

Laravel artisan command that diffs two MySQL databases and generates SQL files describing what the second one is missing — perfect for syncing a staging schema against production.

Install
-------

[](#install)

```
composer require xnoire666/db-diff
```

Laravel auto-discovers the service provider — no manual registration needed.

Configure
---------

[](#configure)

Publish the config file:

```
php artisan vendor:publish --tag=db-diff-config
```

This creates `config/db-diff.php`. Then set the connection details in your application's `.env`:

```
DB_DIFF_MYSQL1_HOST=
DB_DIFF_MYSQL1_DATABASE=
DB_DIFF_MYSQL1_USERNAME=
DB_DIFF_MYSQL1_PASSWORD=

DB_DIFF_MYSQL2_HOST=
DB_DIFF_MYSQL2_DATABASE=
DB_DIFF_MYSQL2_USERNAME=
DB_DIFF_MYSQL2_PASSWORD=
```

- **mysql1** = the *source* (source of truth)
- **mysql2** = the *target* being compared against the source

Optional keys: `DB_DIFF_MYSQL{1,2}_CHARSET`, `DB_DIFF_MYSQL{1,2}_COLLATION`, and `DB_DIFF_OUTPUT_DISK` (defaults to `local`).

Run
---

[](#run)

```
php artisan db:diff
```

Generates the following SQL files in `storage/app/` (or whichever disk you configured):

FileWhat it contains`missing_tables.sql``CREATE TABLE IF NOT EXISTS` for tables that exist in mysql1 but not mysql2`missing_views.sql``CREATE OR REPLACE VIEW` for views missing in mysql2`missing_columns.sql``ALTER TABLE ... ADD COLUMN` for columns missing in mysql2`mismatch_column_props.sql``ALTER TABLE ... MODIFY COLUMN` for columns whose type, nullability, default, or extra differsReview the generated SQL before running it against mysql2.

Requirements
------------

[](#requirements)

- PHP ^8.0
- Laravel 9, 10, 11, or 12
- Both connections must be MySQL (the command uses `SHOW TABLES` / `SHOW CREATE TABLE`)

License
-------

[](#license)

MIT

###  Health Score

31

—

LowBetter than 65% of packages

Maintenance86

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity28

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

67d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fc71c6cf95f471749960cd17073295f2b263e439aa435a07a6306ee58116b5f1?d=identicon)[xnoire666](/maintainers/xnoire666)

---

Top Contributors

[![xnoire666](https://avatars.githubusercontent.com/u/7259786?v=4)](https://github.com/xnoire666 "xnoire666 (7 commits)")

---

Tags

artisandatabaselaravellaravel-packagemysqlphpschemaschema-diffschema-syncdifflaravelschemadatabasemysqlartisansync

### Embed Badge

![Health badge](/badges/xnoire666-db-diff/health.svg)

```
[![Health](https://phpackages.com/badges/xnoire666-db-diff/health.svg)](https://phpackages.com/packages/xnoire666-db-diff)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M246](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

20432.6M1.7k](/packages/illuminate-queue)[itpathsolutions/dbstan

Database Standardization and Analysis Tool for Laravel

463.0k](/packages/itpathsolutions-dbstan)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[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.

4925.3k](/packages/erag-laravel-lang-sync-inertia)

PHPackages © 2026

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