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

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

phpspec/php-diff
================

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

v1.1.3(5y ago)36159.7M↓10.5%31[4 PRs](https://github.com/phpspec/php-diff/pulls)20BSD-3-ClausePHP

Since Nov 8Pushed 3y ago9 watchersCompare

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

READMEChangelog (5)DependenciesVersions (8)Used By (20)

```
PHP Diff Class
--------------

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.

Example Use
-----------
A quick usage example can be found in the example/ directory and under
example.php.

More complete documentation will be available shortly.

Todo
----
 * Ability to ignore blank line changes
 * 3 way diff support
 * Performance optimizations

License (BSD License)
---------------------
Copyright (c) 2009 Chris Boulton
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

 - Redistributions of source code must retain the above copyright notice,
   this list of conditions and the following disclaimer.
 - Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.
 - Neither the name of the Chris Boulton nor the names of its contributors
   may be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
```

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity70

Solid adoption and visibility

Community41

Growing community involvement

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~574 days

Recently: every ~628 days

Total

6

Last Release

2068d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/afabc43afc890656b1d04457e0a313739f481b31275ed565d69ec125d35fef3b?d=identicon)[everzet](/maintainers/everzet)

![](https://www.gravatar.com/avatar/e7c4612e19ba73b517d8c3e15890af6687f8a206eb56676c1714209534378429?d=identicon)[ciaranmcnulty](/maintainers/ciaranmcnulty)

---

Top Contributors

[![everzet](https://avatars.githubusercontent.com/u/30813?v=4)](https://github.com/everzet "everzet (9 commits)")[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (3 commits)")[![AnhNhan](https://avatars.githubusercontent.com/u/3199392?v=4)](https://github.com/AnhNhan "AnhNhan (2 commits)")[![ciaranmcnulty](https://avatars.githubusercontent.com/u/237866?v=4)](https://github.com/ciaranmcnulty "ciaranmcnulty (2 commits)")[![RobLoach](https://avatars.githubusercontent.com/u/25086?v=4)](https://github.com/RobLoach "RobLoach (1 commits)")[![shanethehat](https://avatars.githubusercontent.com/u/604650?v=4)](https://github.com/shanethehat "shanethehat (1 commits)")[![Actine](https://avatars.githubusercontent.com/u/1097083?v=4)](https://github.com/Actine "Actine (1 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (1 commits)")[![chrisboulton](https://avatars.githubusercontent.com/u/98472?v=4)](https://github.com/chrisboulton "chrisboulton (1 commits)")[![dgarrett](https://avatars.githubusercontent.com/u/1408738?v=4)](https://github.com/dgarrett "dgarrett (1 commits)")[![maximal](https://avatars.githubusercontent.com/u/980679?v=4)](https://github.com/maximal "maximal (1 commits)")

### Embed Badge

![Health badge](/badges/phpspec-php-diff/health.svg)

```
[![Health](https://phpackages.com/badges/phpspec-php-diff/health.svg)](https://phpackages.com/packages/phpspec-php-diff)
```

###  Alternatives

[maize-tech/laravel-legal-consent

Laravel Legal Consent

521.8k](/packages/maize-tech-laravel-legal-consent)[millipress/millirules

A declarative rule engine for PHP that turns complex conditional logic into readable when-then rules. Features a fluent builder API, lazy-loaded context for performance, smart operator inference, and works seamlessly in pure PHP or WordPress.

111.3k4](/packages/millipress-millirules)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
