Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ihalavin/gendiff
Structure differences finder
https://github.com/ihalavin/gendiff
data-structures php
Last synced: 15 days ago
JSON representation
Structure differences finder
- Host: GitHub
- URL: https://github.com/ihalavin/gendiff
- Owner: ihalavin
- Created: 2022-02-07T16:48:36.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-11T14:25:52.000Z (almost 3 years ago)
- Last Synced: 2024-12-18T19:52:33.724Z (28 days ago)
- Topics: data-structures, php
- Language: PHP
- Homepage:
- Size: 131 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![PHP CI](https://github.com/ForeachQ/gendiff/actions/workflows/php-ci.yml/badge.svg)](https://github.com/ForeachQ/gendiff/actions/workflows/php-ci.yml)
# Gendiff
«Gendiff» — a program that finds the difference between two data structures.
## Description
Can be used as a separate CLI application or imported as a php package.
Program gets 2 paths and output format as input and returns structures differences in user defined format.
Utility features:
- Recursive processing;
- Support for different input formats: yaml and json;
- Report generation in the form of plain text, "stylish" and json.## Requirements
- php 7.4
- composer 2.*## Installation
### Php package
```bash
composer require foreachq/gendiff
```### Cli application
- Download package```bash
composer create-project foreachq/gendiff
```- Install dependencies
```
make install
```## Usage
### CLI
```bash
# format plain
$ ./gendiff --format plain path/to/file.yml another/path/file.jsonProperty 'common.follow' was added with value: false
Property 'group1.baz' was updated. From 'bas' to 'bars'
Property 'group2' was removed# format by default (stylish)
$ ./gendiff filepath1.json filepath2.json{
+ follow: false
setting1: Value 1
- setting2: 200
- setting3: true
+ setting3: {
key: value
}
+ setting4: blah blah
+ setting5: {
key5: value5
}
}$ ./gendiff -h # for help
```### Php package
```php
use function Differ\Differ\genDiff;// formats: stylish (default), plain, json
$diff = genDiff($pathToFile1, $pathToFile2, $format);
print_r($diff);
```## Asciinemas of usage
- [gendiff-stylish](https://asciinema.org/a/469671)
- [gendiff-plain](https://asciinema.org/a/469672)
- [gendiff-json](https://asciinema.org/a/469673)