PHPackages                             superscanner/finediff - 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. superscanner/finediff

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

superscanner/finediff
=====================

PHP implementation of a Fine granularity Diff engine

2.0.0(3y ago)0602↓100%1MITPHPPHP &gt;=8.0

Since Aug 5Pushed 3y agoCompare

[ Source](https://github.com/Superscanner/php-finediff)[ Packagist](https://packagist.org/packages/superscanner/finediff)[ RSS](/packages/superscanner-finediff/feed)WikiDiscussions 2.x Synced 1mo ago

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

FineDiff
========

[](#finediff)

Originally written by Raymond Hill ()

[![Build Status](https://camo.githubusercontent.com/228e9d62d4feb188e55b1136713ccb20fda6075872898ccaf1b6263b27a74769/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73757065727363616e6e65722f7068702d66696e65646966662e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/superscanner/php-finediff)[![Latest Stable Version](https://camo.githubusercontent.com/1b0610b63dca458fdeb84c7744e160c1fa2bc6c309902c589599eca5fa8fbaca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73757065727363616e6e65722f66696e65646966662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/superscanner/finediff)[![License](https://camo.githubusercontent.com/e9924509b3d90b09274fd54f5f3483d9f76c38eafdb76a105bf444dae2e86f24/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73757065727363616e6e65722f7068702d66696e65646966663f7374796c653d666c61742d737175617265)](#license)

Installation
------------

[](#installation)

```
composer require superscanner/finediff
```

Usage
-----

[](#usage)

### Render HTML

[](#render-html)

Render the difference between two strings as HTML:

```
$diff = new FineDiff\Diff();
echo $diff->render('string one', 'string two');
```

This would then output:

```
string twone
```

You could change the granularity to `CogPowered\FineDiff\Granularity\Word`

```
$diff = new FineDiff\Diff(new FineDiff\Granularity\Word());
// Or via the setter method:
$diff->setGranularity(new FineDiff\Granularity\Word());
```

so the output is:

```
string onetwo
```

You do this by passing it into the Diff constructor:

### Grab opcode instructions

[](#grab-opcode-instructions)

Opcode instructions are what tell FineDiff how to change one string into another.

```
$diff = new FineDiff\Diff();
echo $diff->getOpcodes('string one', 'string two');
```

This would then output:

```
c7d3i3:two
```

Render text using the opcodes:

```
$renderer = new FineDiff\Render\Text();
echo $renderer->process('string one', 'c7d3i3:two');
```

Would output:

```
string two
```

Same with HTML:

```
$renderer = new FineDiff\Render\Html();
echo $renderer->process('string one', 'c7d3i3:two');
```

Credits
-------

[](#credits)

Originally Sponsored by [D4H](https://d4htechnologies.com/). Sponsored by [Superscanner](https://superscanner.nl).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

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 ~169 days

Total

5

Last Release

1428d ago

Major Versions

1.x-dev → 2.0.02022-06-14

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

2.0.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![hannesvdvreken](https://avatars.githubusercontent.com/u/1410358?v=4)](https://github.com/hannesvdvreken "hannesvdvreken (8 commits)")[![amooij](https://avatars.githubusercontent.com/u/493132?v=4)](https://github.com/amooij "amooij (5 commits)")[![finagin](https://avatars.githubusercontent.com/u/11045296?v=4)](https://github.com/finagin "finagin (1 commits)")

---

Tags

diffstringtextfinediffopcode

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/superscanner-finediff/health.svg)

```
[![Health](https://phpackages.com/badges/superscanner-finediff/health.svg)](https://phpackages.com/packages/superscanner-finediff)
```

###  Alternatives

[lolli42/finediff

PHP implementation of a Fine granularity Diff engine

138.8M3](/packages/lolli42-finediff)[d4h/finediff

PHP implementation of a Fine granularity Diff engine

141.3M1](/packages/d4h-finediff)[opis/string

Multibyte strings as objects

7120.9M7](/packages/opis-string)[localheinz/diff

Fork of sebastian/diff for use with ergebnis/composer-normalize

4637.0M5](/packages/localheinz-diff)[phootwork/lang

Missing PHP language constructs

1224.8M8](/packages/phootwork-lang)[edgaras/strsim

Collection of string similarity and distance algorithms in PHP including Levenshtein, Damerau-Levenshtein, Jaro-Winkler, and more

2423.0k](/packages/edgaras-strsim)

PHPackages © 2026

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