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

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

shadiakiki1986/db-diff
======================

0.0.2.1(9y ago)071[4 issues](https://github.com/shadiakiki1986/db-diff/issues)PHP

Since Jan 18Pushed 9y ago1 watchersCompare

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

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

db-diff [![Build Status](https://camo.githubusercontent.com/4b6aaa100030c5a653392c72a5f4e4b2aafad6de2b5ab8668d9886417b50822f/68747470733a2f2f7472617669732d63692e6f72672f7368616469616b696b69313938362f64622d646966662e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/shadiakiki1986/db-diff)
=========================================================================================================================================================================================================================================================================================================

[](#db-diff-)

Console application to version control database table contents and show their daily diff

Does it in 3 steps

1. Set up PHP-ODBC connections and store your database connection in `/etc/odbc.ini`
2. export table from database via ODBC connection to git via [git-rest-api](https://github.com/korya/node-git-rest-api/) server
3. export table again after edits
4. get `git diff` results

Running periodic exports gives more points in time to `diff` against

Similar tools (didn't try them)

- [Red gate](http://www.red-gate.com/products/sql-development/sql-source-control/): similar to this repo, can version control "static data"
- [git-sql](http://www.gitsql.net/): diff of sql data dumps
- [Nayjest/db-diff](https://github.com/Nayjest/db-diff): diff of two tables with the same structure
- [PM-Connect/db-diff](https://github.com/PM-Connect/db-diff): diff of two database structures

Usage
-----

[](#usage)

(Example usage: [docker-db-diff](https://github.com/shadiakiki1986/docker-db-diff/) )

1. Requirements:
2. [PDO-ODBC](http://php.net/manual/en/ref.pdo-odbc.php) driver and a ready connection
3. a [node-git-rest-api](https://github.com/korya/node-git-rest-api/) server with `deep-diff-yml` configured for yml files
4. Set env var for `git-rest-api` server

```
export DBDIFF_GRAPI_HOST=http://localhost:8082
```

3. Synopsis

```
./bin/pdo-git export [--init]  ..
./bin/pdo-git post-commit --format [html,console,json] --  ..
```

Note: the `..` notation is SQLServer-specific. For MySql, use `.` (single dot)

Reset:

```
./bin/pdo-git admin git:deleteAll
```

Testing
-------

[](#testing)

1. (optional) Set up a mysql database to test against locally:

```
docker run \
  -e MYSQL_RANDOM_ROOT_PASSWORD=yes \
  -e MYSQL_DATABASE=mf \
  -e MYSQL_USER=user \
  -e MYSQL_PASSWORD=password \
  -v $PWD/tests/initdb.d:/docker-entrypoint-initdb.d \
  -p 3306:3306 \
  mysql:8
```

Test with

```
mysql --host 127.0.0.1 --user user --password
> use mf;
> select * from t1
```

2. (optional) Run the `git-rest-api` server locally:

```
docker-compose up git
```

3. (optional) Set up dev env using option 1 or 2 below
4. Install dependencies: `composer install`
5. Run tests: `composer test`

### Option 1: Dev env with vagrant

[](#option-1-dev-env-with-vagrant)

```
cd exporter
vagrant up
VAGRANT> composer test
```

### Option 2: Manually

[](#option-2-manually)

Install `odbc` drivers like [docker-php7...](https://github.com/shadiakiki1986/docker-php7-apache-odbc-and-other/blob/master/Dockerfile): `[sudo] apt-get unixodbc unixodbc-dev tdsodbc php7.0-odbc`

Test installation with : `php -i|grep odbc`

Install mysql-odbc drivers

1. [ubuntu 13.04](http://askubuntu.com/a/258295/543234): `apt-get install libmyodbc`
2. [ubuntu 16.04](http://askubuntu.com/a/822399/543234):

```
wget https://cdn.mysql.com//Downloads/Connector-ODBC/5.3/mysql-connector-odbc-5.3.7-linux-ubuntu16.04-x86-64bit.tar.gz
tar -xzf mysql-connector-odbc-5.3.7-linux-ubuntu16.04-x86-64bit.tar.gz
cd mysql.../lib
cp * /usr/lib/x86_64.../odbc/
```

Set up odbc configuration

```
cp etc/odbc.dev.ini /etc/
cp etc/odbcinst.dev.ini /etc/
```

Test with

```
isql MarketflowAcc user password
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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

Every ~1 days

Total

3

Last Release

3402d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2cc997a8672e96aaee90c8555b7e5bc9693894e74c7530abf2216ee6799357ff?d=identicon)[shadiakiki1986](/maintainers/shadiakiki1986)

---

Top Contributors

[![shadiakiki1986](https://avatars.githubusercontent.com/u/8392324?v=4)](https://github.com/shadiakiki1986 "shadiakiki1986 (53 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[bolt/core

🧿 Bolt Core

585142.5k54](/packages/bolt-core)[worksome/foggy

Foggy is a tool for making database dumps with some data removed/changed.

26571.7k1](/packages/worksome-foggy)[salsadigitalauorg/merlin-framework

Open source migration framework (markup to structured data)

182.8k](/packages/salsadigitalauorg-merlin-framework)

PHPackages © 2026

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