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

ActiveLibrary

riki137/finediff
================

PHP8 implementation of a Fine granularity Diff engine

1.1.2(3y ago)1171.4k—7.2%1MITPHPPHP ^7.4 || ^8.1

Since Aug 5Pushed 3y agoCompare

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

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

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 53.3% 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 ~110 days

Recently: every ~0 days

Total

7

Last Release

1454d ago

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

1.0.2PHP ^7.4 || ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/1672f5f9f3ea6591c73db424f279144a4634bda6f8cfbd2038680394e8007ccd?d=identicon)[riki137](/maintainers/riki137)

---

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)")

---

Tags

diffstringtextfinediffopcode

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

Parser for well-known binary (WKB/EWKB) object data

615.1M16](/packages/creof-wkb-parser)[creof/geo-parser

Parser for geography coordinate strings

624.4M15](/packages/creof-geo-parser)[creof/wkt-parser

Parser for well-known text (WKT) object strings

554.8M16](/packages/creof-wkt-parser)[vria/nodiacritic

Tiny helper function that removes all diacritical signs from characters

113.1M13](/packages/vria-nodiacritic)

PHPackages © 2026

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