PHPackages                             ava/gendiff - 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. ava/gendiff

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

ava/gendiff
===========

Generate diff

0.7.11(5y ago)021MITPHPCI failing

Since Jul 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ava239/gendiff)[ Packagist](https://packagist.org/packages/ava/gendiff)[ RSS](/packages/ava-gendiff/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (5)Versions (29)Used By (0)

Gendiff CLI utility
===================

[](#gendiff-cli-utility)

[![CI](https://github.com/ava239/php-project-lvl2/workflows/CI/badge.svg)](https://github.com/ava239/php-project-lvl2/workflows/CI/badge.svg)[![Maintainability](https://camo.githubusercontent.com/1a3a5fd679f029a900aaad7432d752d66ea9d342cb016b9889746be1acbeeee7/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f32356566313836313936653335343665316231612f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/ava239/php-project-lvl2/maintainability)[![Test Coverage](https://camo.githubusercontent.com/bfe8f6dac833c61f4c750cb11bbf25cd251283c2bea1fadb24e2729263b93491/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f32356566313836313936653335343665316231612f746573745f636f766572616765)](https://codeclimate.com/github/ava239/php-project-lvl2/test_coverage)

Description
-----------

[](#description)

Utility can generate diff between two files
Can be used as standalone CLI utility or as a library
Supports absolute and relative paths to files
File formats supported:

- json
- yaml

Output formats supported (see below for examples):

- pretty
- plain
- json

Requirements
------------

[](#requirements)

- PHP 7.4
- ext-json extension installed

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

[](#installation)

### Standalone CLI utility

[](#standalone-cli-utility)

Global installation with composer recomended

```
$ composer g require ava/gendiff
```

[![asciicast](https://camo.githubusercontent.com/0fbad47a81e419247765a9bed8a7ff5087bb48116d3b5090fb99dab091e9ab30/68747470733a2f2f61736369696e656d612e6f72672f612f3335323336352e737667)](https://asciinema.org/a/352365)Then you can run it globally (if you have global composer dir in your $PATH) as CLI program

Usage format is:

```
$ gendiff [--format ]
```

You can always get usage help with

```
$ gendiff -h
```

There are usage examples in section below

### Library

[](#library)

Composer is recomended to install

```
$ composer require ava/gendiff
```

Then you can use it in your project

```
use function Gendiff\Core\compareFiles;
...
$diff = compareFiles($filepath1, $filepath2);
```

This will return diff between files in pretty format
You also can pass 3rd argument to change format Formats supported:

- pretty
- plain
- json

Below you can find examples how different formats looks

Usage examples (CLI version)
----------------------------

[](#usage-examples-cli-version)

pretty print format [![asciicast](https://camo.githubusercontent.com/62bdc9bf1aa6d5d05979f34755b584bdde87309ae72ca3ff135e6f2be6dcc1cd/68747470733a2f2f61736369696e656d612e6f72672f612f3335313130392e737667)](https://asciinema.org/a/351109)

plain format [![asciicast](https://camo.githubusercontent.com/4bc96e229595e4421de95ccc6822b744c2433b9bd22da5b3866a334fa651f9b6/68747470733a2f2f61736369696e656d612e6f72672f612f3335313236312e737667)](https://asciinema.org/a/351261)

json format output [![asciicast](https://camo.githubusercontent.com/5d8dca174e1164e6815c43bc16a418627a1cfbdbc904b49d76515e7890810d0b/68747470733a2f2f61736369696e656d612e6f72672f612f3335313436372e737667)](https://asciinema.org/a/351467)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

28

Last Release

2093d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/111c53de1db8bfcf869acce973484fe46cafc20de6689012a5be2dc2d204855c?d=identicon)[ava239](/maintainers/ava239)

---

Top Contributors

[![ava239](https://avatars.githubusercontent.com/u/24976731?v=4)](https://github.com/ava239 "ava239 (61 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/ava-gendiff/health.svg)

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

PHPackages © 2026

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