PHPackages                             adaptive/php-text-difference - 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. adaptive/php-text-difference

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

adaptive/php-text-difference
============================

A comprehensive library for generating differences between two hashable objects (strings or arrays). Fork of a fork to add namespaces and psr-4 autoloading

v1.1.0(4y ago)969.4k↓15.7%6BSD-3-ClausePHP

Since Nov 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/adaptivemedia/php-text-difference)[ Packagist](https://packagist.org/packages/adaptive/php-text-difference)[ RSS](/packages/adaptive-php-text-difference/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)DependenciesVersions (5)Used By (0)

PHP Text Difference Class
=========================

[](#php-text-difference-class)

Introduction
------------

[](#introduction)

A comprehensive library for generating differences between two hashable objects (strings or arrays). Generated differences can be rendered in all of the standard formats including:

- Unified
- Context
- Inline HTML
- Side by Side HTML

The logic behind the core of the diff engine (ie, the sequence matcher) is primarily based on the Python difflib package. The reason for doing so is primarily because of its high degree of accuracy.

Install
-------

[](#install)

Via Composer

```
{
    "require": {
        "adaptive/php-text-difference": "^1.1"
    }
}
```

Example Use
-----------

[](#example-use)

A quick usage example can be found in the example/ directory and under example.php. Simple usage example:

```
