occulo/gendiff

A PHP-based diff generator for files

Maintainers

Package info

github.com/occulo/gendiff

pkg:composer/occulo/gendiff

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-03-11 16:31 UTC

This package is auto-updated.

Last update: 2026-04-11 16:48:01 UTC


README

Packagist Version PHP CI Quality Gate Status

Description

Gendiff is a CLI tool and library for generating differences between two configuration files. Supports multiple output formats: stylish, plain, and JSON.

Prerequisites

  • Linux, MacOS, WSL
  • PHP >=8.3
  • Composer >=2.0
  • Git
  • Make

Installation

Composer (recommended)

If you use Composer, you can install the package locally with the following command:

composer require occulo/gendiff

Or globally:

composer global require occulo/gendiff

Source

If you wish to install from source, run:

git clone https://github.com/occulo/gendiff.git
cd gendiff
make install

This will clone the repository to your machine and install all required Composer dependencies.

Supported Formats

Gendiff can compare configuration files in the following formats:

  • JSON (.json)
  • YAML (.yaml, .yml)

Usage

gendiff (-h|--help)
gendiff (-v|--version)
gendiff [--format <fmt>] <firstFile> <secondFile>

Demo

Input files

file1.json

{
  "key1": "value1",
  "key2": true,
  "key3": 123
}

file2.json

{
  "key1": "value1",
  "key2": false,
  "key4": "new"
}

Stylish format

gendiff --format stylish file1.json file2.json
{
    key1: value1
  - key2: true
  + key2: false
  - key3: 123
  + key4: new
}

Plain format

gendiff --format plain file1.json file2.json
Property 'key2' was updated. From true to false
Property 'key3' was removed
Property 'key4' was added with value: 'new'

JSON format

gendiff --format json file1.json file2.json
{
    "key1": {
        "status": "unchanged",
        "value": "value1"
    },
    "key2": {
        "status": "changed",
        "value": {
            "old": true,
            "new": false
        }
    },
    "key3": {
        "status": "removed",
        "value": 123
    },
    "key4": {
        "status": "added",
        "value": "new"
    }
}