PHPackages                             jblond/php-diff - 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. jblond/php-diff

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

jblond/php-diff
===============

A comprehensive library for generating differences between two hashable objects (strings or arrays).

2.5.0(7mo ago)36125.1k—7.8%4[1 issues](https://github.com/JBlond/php-diff/issues)[1 PRs](https://github.com/JBlond/php-diff/pulls)1BSD-3-ClausePHPPHP &gt;=7.3

Since May 5Pushed 7mo ago5 watchersCompare

[ Source](https://github.com/JBlond/php-diff)[ Packagist](https://packagist.org/packages/jblond/php-diff)[ RSS](/packages/jblond-php-diff/feed)WikiDiscussions master Synced 1mo ago

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

PHP Diff Class
==============

[](#php-diff-class)

[![Codacy Badge](https://camo.githubusercontent.com/9a849e3ff1427ee50690f8e579aa3b3946c466d29eae0c899f09aca4d31cb81e/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6462356638643537623132333435303261656238353261666338376530646665)](https://app.codacy.com/gh/JBlond/php-diff/dashboard)[![Latest Version](https://camo.githubusercontent.com/f8d4a5010f01d2c46a52871cfe7fa9b25c150f9a4e85d81401d89d7bc015f7db/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f4a426c6f6e642f7068702d646966662e7376673f7374796c653d666c61742d737175617265266c6162656c3d52656c65617365)](https://github.com/JBlond/php-diff/releases)[![Packagist Installs](https://camo.githubusercontent.com/3b377f1a6f14a2e489f7d67759d6b65363d46ba84f7af6c04d1e84272c5d01e0/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f64742f4a426c6f6e642f7068702d64696666)](https://packagist.org/packages/jblond/php-diff)

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

[](#introduction)

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

- Unified
- Context
- Side by Side HTML
- Unified HTML
- Unified Commandline colored output
- JSON

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)

```
composer require jblond/php-diff
```

### Install for cli support

[](#install-for-cli-support)

For cli usage you need to install the suggested `jblond/php-cli` package.

Documentation
-------------

[](#documentation)

See the [Wiki](https://github.com/JBlond/php-diff/wiki) for

- [Getting started](https://github.com/JBlond/php-diff/wiki/1.-Getting-Started)
- [Parameters and Options](https://github.com/JBlond/php-diff/wiki/2.-Parameters-and-Options)
- [Custom Renderer](https://github.com/JBlond/php-diff/wiki/3.-Custom-Renderer)
- [Styling](https://github.com/JBlond/php-diff/wiki/4.-Styling)

Changelog
---------

[](#changelog)

[Changelog](changelog.md)

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

[](#example-use)

```
