PHPackages                             pm-connect/db-diff-utils - 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. pm-connect/db-diff-utils

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

pm-connect/db-diff-utils
========================

Database Diff Utilities

1.0.7(9y ago)0321MITPHPPHP 7.\*

Since Dec 14Pushed 9y agoCompare

[ Source](https://github.com/PM-Connect/db-diff-utils)[ Packagist](https://packagist.org/packages/pm-connect/db-diff-utils)[ RSS](/packages/pm-connect-db-diff-utils/feed)WikiDiscussions master Synced today

READMEChangelog (9)Dependencies (3)Versions (10)Used By (1)

Database Diff Utils [![Build Status](https://camo.githubusercontent.com/6fe632683846b5b8f6a118fca092286aeb5d9d6fdba56e6899f78c216c2f95a2/68747470733a2f2f7472617669732d63692e6f72672f504d2d436f6e6e6563742f64622d646966662d7574696c732e737667)](https://travis-ci.org/PM-Connect/db-diff-utils) [![Latest Stable Version](https://camo.githubusercontent.com/32f023cdfe0694a3c778a9c45ba788c2095287b790fd4fe0c41a3f2bd349775d/68747470733a2f2f706f7365722e707567782e6f72672f706d2d636f6e6e6563742f64622d646966662d7574696c732f762f737461626c65)](https://packagist.org/packages/pm-connect/db-diff-utils) [![Total Downloads](https://camo.githubusercontent.com/a8518b482aebb13c02e584192569bd16cdd10fd717fb7412cedd370fc4f14d43/68747470733a2f2f706f7365722e707567782e6f72672f706d2d636f6e6e6563742f64622d646966662d7574696c732f646f776e6c6f6164732e737667)](https://packagist.org/packages/pm-connect/db-diff-utils) [![Latest Unstable Version](https://camo.githubusercontent.com/238348c9961406fd437b3769819c8278247245e150b41f2c773681b429013628/68747470733a2f2f706f7365722e707567782e6f72672f706d2d636f6e6e6563742f64622d646966662d7574696c732f762f756e737461626c652e737667)](https://packagist.org/packages/pm-connect/db-diff-utils) [![License](https://camo.githubusercontent.com/0bb54105fd6c6a40245601571237a77b8067c921c621038517f56fecf833e757/68747470733a2f2f706f7365722e707567782e6f72672f706d2d636f6e6e6563742f64622d646966662d7574696c732f6c6963656e73652e737667)](https://packagist.org/packages/pm-connect/db-diff-utils)
=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#database-diff-utils-----)

Looking For An All-In-One DB Structure Diff Tool?
-------------------------------------------------

[](#looking-for-an-all-in-one-db-structure-diff-tool)

If you're looking for an all-in-one database diff tool, checkout [DB Diff](https://github.com/PM-Connect/db-diff)

Intro
-----

[](#intro)

A simple set of utilities to be used for generating a diff between 2 database connections and their structures (not data).

Also contains a Laravel service provider and console command that can diff 2 given databases.

- [Installation](#installation)
    - [Laravel Service Provider](#optional-add-the-laravel-service-provider)
- [Usage](#usage)
    - [Using The Provided Objects](#using-the-provided-objects)
    - [Using The Artisan Console Command](#using-the-laravel-artisan-console-command)

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

[](#installation)

Install through composer.

```
composer require pm-connect/db-diff-utils

```

### *Optional* Add The Laravel Service Provider

[](#optional-add-the-laravel-service-provider)

Add the following line to your `config/app.php` file within the providers array if you wish to use the provided artisan command.

```
...
PMConnect\DBDiff\Utils\DBDiffUtilServiceProvider::class,
...

```

Usage
-----

[](#usage)

The provided diff utilities can be used in 2 ways.

1. Using the provided objects where you need them.
2. Using the provided artisan console command `db:diff`.

### Using The Provided Objects

[](#using-the-provided-objects)

The package provides the following objects for your use:

#### `PMConnect\DBDiff\Utils\Diff`

[](#pmconnectdbdiffutilsdiff)

This object provides a basic wrapper to the other available objects and is capable of running a full diff.

##### Example Use

[](#example-use)

The `Diff` object accepts in the following as constructor parameters.

1. `PMConnect\DBDiff\Utils\Contracts\Output`
    - Create an implementation of this to save the output of the diff.
2. `Illuminate\Database\Connection`
    - Provide connection instances to the databases you wish to diff.
    - This can be done easily using `Illuminate\Database\Connectors\ConnectionFactory`
    - This can also be done by manually creating instances of the connections you wish to use.
        - `Illuminate\Database\MySqlConnection`
        - `Illuminate\Database\PostgresConnection`
        - `Illuminate\Database\SQLiteConnection`

```
