mariya/gendiff

There is no license information available for the latest version (v6.0.1) of this package.

The second PHP project, utility to find differences in configuration files.

v6.0.1 2019-04-16 04:09 UTC

This package is auto-updated.

Last update: 2024-04-16 15:18:41 UTC


README

Maintainability Build Status

A PHP console utility to find differences in configuration files.

Utility features:

  • Multi-format support
  • Report generation as plain text, pretty и json

Installation

Via Composer

$ composer require mariya/gendiff

Usage

Get help:

$ gendiff -h

Generate the difference between two files (json, yaml):

$ gendiff before.json after.json

The utility supports different output formats. By default, the report is generated as pretty. Example:

$ gendiff before.json after.json

{
    host: hexlet.io
  + timeout: 20
  - timeout: 50
  - proxy: 123.234.53.22
  + verbose: true
}

Using the option --format with value plain to get a report in the following format:

$ gendiff --format plain before.json after.json

Property 'timeout' was changed. From '50' to '20'
Property 'proxy' was removed
Property 'verbose' was added with value: 'true'

In addition, you can get the report in json format using the appropriate option value:

$ gendiff --format json before.json after.json

{"0":{"key":"host","type":"unchanged","valueBefore":"hexlet.io","valueAfter":"hexlet.io","children":null},"1":{"key":"timeout","type":"changed","valueBefore":50,"valueAfter":20,"children":null},"2":{"key":"proxy","type":"deleted","valueBefore":"123.234.53.22","valueAfter":null,"children":null},"3":{"key":"verbose","type":"added","valueBefore":null,"valueAfter":true,"children":null}}