PHPackages                             sebastian/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. [Testing &amp; Quality](/categories/testing)
4. /
5. sebastian/diff

ActiveLibrary[Testing &amp; Quality](/categories/testing)

sebastian/diff
==============

Diff implementation

8.0.0(3mo ago)7.7k901.5M↓12.5%85[4 issues](https://github.com/sebastianbergmann/diff/issues)[3 PRs](https://github.com/sebastianbergmann/diff/pulls)20BSD-3-ClausePHPPHP &gt;=8.4CI passing

Since Jul 9Pushed today25 watchersCompare

[ Source](https://github.com/sebastianbergmann/diff)[ Packagist](https://packagist.org/packages/sebastian/diff)[ Docs](https://github.com/sebastianbergmann/diff)[ GitHub Sponsors](https://github.com/sebastianbergmann)[ Fund](https://liberapay.com/sebastianbergmann)[ RSS](/packages/sebastian-diff/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (42)Used By (20)

[![Latest Stable Version](https://camo.githubusercontent.com/06cc90cb4ac786024373e5cd77ec60f86d2b8931be7549d43f5efba539f203a7/68747470733a2f2f706f7365722e707567782e6f72672f73656261737469616e2f646966662f76)](https://packagist.org/packages/sebastian/diff)[![CI Status](https://github.com/sebastianbergmann/diff/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/diff/actions)[![codecov](https://camo.githubusercontent.com/6da2bf9decf8f35b4bbbc8144ad7de9c46355c9b4427cff70ab473716feab18e/68747470733a2f2f636f6465636f762e696f2f67682f73656261737469616e626572676d616e6e2f646966662f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/sebastianbergmann/diff)

sebastian/diff
==============

[](#sebastiandiff)

Diff implementation for PHP, factored out of PHPUnit into a stand-alone component.

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

[](#installation)

You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):

```
composer require sebastian/diff

```

If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:

```
composer require --dev sebastian/diff

```

### Usage

[](#usage)

#### Generating diff

[](#generating-diff)

The `Differ` class can be used to generate a textual representation of the difference between two strings:

```
