PHPackages                             wambacom/dbff - 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. wambacom/dbff

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

wambacom/dbff
=============

Diff for DB

0.6.0(11y ago)02.4kGPL-2.0PHPPHP &gt;=5.4.0

Since Mar 27Pushed 11y ago4 watchersCompare

[ Source](https://github.com/mambaru/dbff)[ Packagist](https://packagist.org/packages/wambacom/dbff)[ RSS](/packages/wambacom-dbff/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/e8c0e0d4b455871a4d392797664671aa1141b4e13f622d254068d2433046c070/68747470733a2f2f7472617669732d63692e6f72672f6b73696d6b612f646266662e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/ksimka/dbff) [![Code Coverage](https://camo.githubusercontent.com/f220ed5a29bb968492a34227a1b5cba49415483c9d45a44e3fc79dd28f47ff63/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b73696d6b612f646266662f6261646765732f636f7665726167652e706e673f733d66353439356433636330396566383138366161356566316638323431653162656234363834386634)](https://scrutinizer-ci.com/g/ksimka/dbff/) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/bf42643e539cce90647421e4ad878fde0dbbac29cf7753e51cb7180696d8d6e2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b73696d6b612f646266662f6261646765732f7175616c6974792d73636f72652e706e673f733d34623164343733363030303738643231393330366535616536616466373133613735643064303632)](https://scrutinizer-ci.com/g/ksimka/dbff/) [![Still maintained](https://camo.githubusercontent.com/7248c8b5d2b37018099c70fa79fdcb8707cf583112519d77a78eaefdc20cdef6/687474703a2f2f7374696c6c6d61696e7461696e65642e636f6d2f6b73696d6b612f646266662e706e67)](http://stillmaintained.com/ksimka/dbff)

Dbff
====

[](#dbff)

Dbff (mix of *db* and *diff*, pronounced like *dibiff*) — tool for comparing database structures. Currently available only for MySQL.

Dbff can compare

- databases
- tables
- columns
- indices
- data types

Obviously, it doesn't cover 100% of MySQL structures. We support only things we need so far. But you can improve this library, you are welcome ;)

Dbff structure
--------------

[](#dbff-structure)

Dbff consists of several decoupled parts:

- element — you can create it, fill it with any values and compare
- parser — converts string presentation of element, taken from 'show create' statement, to array of named values. You can use these values on your own, i.e. for initializing elements or for makink your own diff
- builder — helper for creating elements directly from strings. It takes parsers and other builders as dependencies and use them for building elements
- dbffer — dbff tool itself. It takes two elements and produce some diff in a form of array

### Elements

[](#elements)

There are 6 elements

- typeprop — group of properties for some type
- type
- index
- column
- table
- database

### Parsers

[](#parsers)

We have parser for each element

- type parser (for type and typeprop) — parses type definition from column
- index parser — parses index definition taken from "create table" statement
- column parser — parses column definition taken from "create table" statement
- table parser — parses whole "create table" statement
- database parser — parses "create database" statement

Parsers return structs — arrays with specific keys for each element. See schemas to find out struct keys.

All parsers have `parse` method.

### Builders

[](#builders)

Parsers return structs that therefore can be used to fill elements. Doing this manually is boring. So builders do it for you. They create elements directly from strings.

We have builders for each element

- type builder
- index builder
- column builder
- table builder
- database builder

All builders have `createFromString` method.

Complex builders have a lot of dependencies, so for easier creating default builders use `DefaultBuilderFactory`.

### Dbffer

[](#dbffer)

Dbffer can compare elements with `compareElements` method and compare collections with `compareCollections` method.

Dependencies
------------

[](#dependencies)

This package has no dependencies. Its' components are decoupled. You can use only parsers or you can fill elements manually or you can add your own elements or you can implement your own parsers and still use Dbff.

Examples
--------

[](#examples)

Documentation is in development. Please see example.php file provided with this package.

TODO
----

[](#todo)

- documentation and more examples
- dbff-core — this package, main functionality
- dbff-altr — tool for building alter statements from dbff output
- dbff-ignr — ignorator tool for ignoring some parts of schema in dbff output (say, you don't want to compare charsets)
- dbff-drvr — tool for making dbff directly from provided connections to databases
- dbff-humn — humanize output of dbffer (instead of inexpressive array)
- dbff-dbff — dbff object instead of array
- dbff-full — build of all dbff subpackages, unlimited power :)

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.5% 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

4377d ago

### Community

Maintainers

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

---

Top Contributors

[![ksimka](https://avatars.githubusercontent.com/u/1818850?v=4)](https://github.com/ksimka "ksimka (21 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

diffdatabasemysqlcomparedb

### Embed Badge

![Health badge](/badges/wambacom-dbff/health.svg)

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

###  Alternatives

[fpdo/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

921242.9k7](/packages/fpdo-fluentpdo)[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

62397.6k9](/packages/rah-danpu)[kohkimakimoto/lib-migration

LibMigration is a minimum database migration library and framework for MySQL.

1233.4k](/packages/kohkimakimoto-lib-migration)[smrtr/mysql-version-control

A crude version control system for mysql written in php

221.4k](/packages/smrtr-mysql-version-control)[davmixcool/php-dbcloud

Easily backup PostgreSql or MySql database to the cloud

111.5k](/packages/davmixcool-php-dbcloud)

PHPackages © 2026

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