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

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

cbwar/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

1.3.0(4y ago)02.5k↓83.3%BSD-3-ClausePHPPHP ^7.0|^8.0

Since Nov 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/cbwar/php-text-difference)[ Packagist](https://packagist.org/packages/cbwar/php-text-difference)[ RSS](/packages/cbwar-php-text-difference/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (9)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

```
composer require cbwar/php-text-difference

```

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

[](#example-use)

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

```
