定制 occulo/gendiff 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

occulo/gendiff

最新稳定版本:v1.0.0

Composer 安装命令:

composer require occulo/gendiff

包简介

A PHP-based diff generator for files

关键字:

README 文档

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

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固