PHPackages                             yetanotherape/diff-match-patch - 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. yetanotherape/diff-match-patch

ActiveLibrary

yetanotherape/diff-match-patch
==============================

Port of the google-diff-match-patch (https://github.com/google/diff-match-patch) lib to PHP

v1.1.1(1y ago)158915.9k↓12.4%339Apache-2.0PHPPHP &gt;=7.3CI passing

Since Nov 24Pushed 1y ago10 watchersCompare

[ Source](https://github.com/yetanotherape/diff-match-patch)[ Packagist](https://packagist.org/packages/yetanotherape/diff-match-patch)[ Docs](https://github.com/yetanotherape/diff-match-patch)[ RSS](/packages/yetanotherape-diff-match-patch/feed)WikiDiscussions master Synced 1mo ago

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

Diff-Match-Patch
================

[](#diff-match-patch)

[![Latest Stable Version](https://camo.githubusercontent.com/945a6100e8ce6255f40db0a50dea68999a8d1b2cbef70263b54fe5f615b1e619/68747470733a2f2f706f7365722e707567782e6f72672f796574616e6f746865726170652f646966662d6d617463682d70617463682f76)](https://packagist.org/packages/yetanotherape/diff-match-patch)[![CI Status](https://github.com/yetanotherape/diff-match-patch/workflows/CI/badge.svg)](https://github.com/yetanotherape/diff-match-patch/actions)[![Total Downloads](https://camo.githubusercontent.com/f48c5a47379d56837527da7c81bcbb1263c7cd83ba7e9ffa1fd70a463bbb73fc/68747470733a2f2f706f7365722e707567782e6f72672f796574616e6f746865726170652f646966662d6d617463682d70617463682f646f776e6c6f616473)](https://packagist.org/packages/yetanotherape/diff-match-patch)

The Diff Match and Patch libraries offer robust algorithms to perform the operations required for synchronizing plain text:

- computes character-based diff of two texts
- performs fuzzy match of given string
- applies a list of patches.

This is the port of Google's [diff-match-patch](https://github.com/google/diff-match-patch) library to PHP.

Diff
----

[](#diff)

Compare two plain text and efficiently return a array of differences. It works with characters, but if you want to compute word-based or line-based diff — you can easily [tune](https://web.archive.org/web/20160110201643/https://code.google.com/p/google-diff-match-patch/wiki/LineOrWordDiffs)it for your needs.

Usage:

```
