stanislavk / gendiff
Hexlet 的第二个项目
v1.1
2021-04-08 06:52 UTC
Requires
- docopt/docopt: ^1.0
- funct/funct: ^1.5
- symfony/yaml: ^5.2
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: 3.*
README
命令行应用程序和PHP包,可以通过Composer安装,用于在两个文件之间查找差异Composer
composer require stanislavk/gendiff
使用
<?php
use function Differ\Differ\genDiff;
$diff = genDiff($pathToFile1, $pathToFile2, $format = 'stylish');
print_r($diff);
格式
'stylish' (default), 'plain' and 'json'.
file1.json
{
"host": "hexlet.io",
"timeout": 50,
"proxy": "123.234.53.22",
"follow": false
}
file2.json
{
"timeout": 20,
"verbose": true,
"host": "hexlet.io"
}
结果
{
- follow: false
host: hexlet.io
- proxy: 123.234.53.22
- timeout: 50
+ timeout: 20
+ verbose: true
}