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

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

helpspace/finediff
==================

PHP8 implementation of a Fine granularity Diff engine

1.0.0(3y ago)0353↓50%MITPHPPHP ^7.4 || ^8.1

Since Jan 11Pushed 3y agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

FineDiff
========

[](#finediff)

Originally written by Raymond Hill ()

[![Build Status](https://camo.githubusercontent.com/ae6999d8416b84d72712c3b64c323c719e83a5ad4adc6520ecb695c107a790c8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6434682f7068702d66696e65646966662e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/d4h/php-finediff)[![Latest Stable Version](https://camo.githubusercontent.com/65b0301d91b5c717558720b842abc7eea5318432f1bc7a22c844280b3bd311bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6434682f66696e65646966662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/d4h/finediff)[![License](https://camo.githubusercontent.com/6ba0a49633cccdfc1af065f25178300dbc6c62bfea278d6f833933a9e8c0e880/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6434682f7068702d66696e65646966663f7374796c653d666c61742d737175617265)](#license)

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

[](#installation)

```
composer require d4h/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)

Sponsored by [D4H](https://d4htechnologies.com/).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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 ~0 days

Total

2

Last Release

1222d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1627927f5b6f362367f9b2b6db7c73f840b09cca4b86f061888c4e0635db60c2?d=identicon)[helpspace](/maintainers/helpspace)

---

Top Contributors

[![hannesvdvreken](https://avatars.githubusercontent.com/u/1410358?v=4)](https://github.com/hannesvdvreken "hannesvdvreken (8 commits)")[![riki137](https://avatars.githubusercontent.com/u/1223388?v=4)](https://github.com/riki137 "riki137 (4 commits)")[![amooij](https://avatars.githubusercontent.com/u/493132?v=4)](https://github.com/amooij "amooij (2 commits)")[![finagin](https://avatars.githubusercontent.com/u/11045296?v=4)](https://github.com/finagin "finagin (1 commits)")[![Stefan-Dressler](https://avatars.githubusercontent.com/u/34586437?v=4)](https://github.com/Stefan-Dressler "Stefan-Dressler (1 commits)")

---

Tags

diffstringtextfinediffopcode

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/helpspace-finediff/health.svg)](https://phpackages.com/packages/helpspace-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)
