PHPackages                             vielhuber/magicdiff - 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. vielhuber/magicdiff

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

vielhuber/magicdiff
===================

Generates a sql diff between two given database states.

1.0.6(8y ago)2331MITPHPPHP &gt;=5.6

Since May 8Pushed 8y ago2 watchersCompare

[ Source](https://github.com/vielhuber/magicdiff)[ Packagist](https://packagist.org/packages/vielhuber/magicdiff)[ RSS](/packages/vielhuber-magicdiff/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (8)Used By (1)

☕ magicdiff ☕
=============

[](#-magicdiff-)

magicdiff generates automagically sql diffs for a database between two given states.

Key benefits
------------

[](#key-benefits)

- Spits out real sql queries that can be applied on previous state
- Does not use sql triggers or binary / ddl logs
- Works with any shared hosting provider
- Data and schema changes, at the same time
- Fast
- Command line tool and class usage possible
- Covered through test suite
- Returns (separate) diffs and patch files
- Can ignore certain tables
- Takes care of (primary) keys and all kinds or altering tables
- Zero dependencies

Disclaimer
----------

[](#disclaimer)

This does not prevent you from taking backups. Use this script at your own risk.

Command line
------------

[](#command-line)

### Installation

[](#installation)

```
wget https://raw.githubusercontent.com/vielhuber/magicdiff/master/src/magicdiff.php

```

### Usage

[](#usage)

```
php magicdiff.php setup
php magicdiff.php init
php magicdiff.php diff

```

Class
-----

[](#class)

### Installation

[](#installation-1)

```
composer require vielhuber/magicdiff

```

### Usage

[](#usage-1)

```
