PHPackages                             relaxedws/merge - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. relaxedws/merge

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

relaxedws/merge
===============

Library used to perform merges between normalized array structures.

4363[2 PRs](https://github.com/relaxedws/merge/pulls)PHP

Since Jun 20Pushed 7y agoCompare

[ Source](https://github.com/relaxedws/merge)[ Packagist](https://packagist.org/packages/relaxedws/merge)[ RSS](/packages/relaxedws-merge/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Relaxedws/merge [![Build Status](https://camo.githubusercontent.com/9b324b881c5c92a4d78220b90bc8fd652d398586e57cb486aed5b02052bab887/68747470733a2f2f7472617669732d63692e6f72672f72656c6178656477732f6d657267652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/relaxedws/merge)
============================================================================================================================================================================================================================================================================================

[](#relaxedwsmerge-)

A Library to perform recursive 3-way merge algorithm on associative arrays, written in PHP.

Insight
-------

[](#insight)

This library is built to perform a recursive 3-way merge algorithm. It takes 3 parameters which are arrays representing base array, local array and remote array. It compares each of these entities with other arrays line-wise. If only one out of remote or local is updated out of these 3, the final revision will have all the unchanged data in it along with the update data from the update array (Either remote or local). If more than one array is updated on the same line, it'd throw a `ConflictException`.

Install
-------

[](#install)

The library can be installed via [composer](http://getcomposer.org).

```
{
  "name": "myorg/mylib",
  "description": "A library depending on 3-way merge",
  "require": {
    "relaxedws/merge": "dev-master",
  }
}
```

Example
-------

[](#example)

After [installation](#install), we can perform a merge the following way:

```
