Merql

Pure PHP three-way database merge with column-level conflict resolution. Git-style merge semantics applied to MySQL and SQLite tables.

Three-Way Merge

Base, ours, theirs. Same algorithm git uses, applied to relational data. Detects inserts, updates, and deletes across two branches.

Column-Level Resolution

When both sides change the same row, merql compares column by column. Only conflicts when the same column is changed to different values.

Cell-Level Merge

TEXT columns merge line-by-line using Myers diff. JSON columns merge key-by-key. Resolves cases that column-level merge would flag as conflicts.

Multi-Database

Pluggable driver system with MySQL and SQLite built in. Add any PDO-supported database by implementing five methods.

Conflict Detection

Update vs update, update vs delete, insert vs insert. Every conflict type identified with table, row, and column precision.

SQL Generation

Parameterized INSERT, UPDATE, DELETE statements with FK-aware ordering. Dry-run preview or apply in a transaction.

CLI

Snapshot, diff, and merge from the command line. Supports MySQL and SQLite via environment variables.

Oracle-Tested

32 regression scenarios across 6 categories, 195 unit and integration tests, PHPStan level 8.

Ready to search smarter?

Install the Composer package and run your first text or AST search in seconds.

Read the Docs