1. Go to this page and download the library: Download konsulting/json-diff library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
konsulting / json-diff example snippets
use Konsulting\JsonDiff;
// Using 'new'
$diff = (new JsonDiff('["json"]'))->exclude(['key'])->compareTo('["different_json"]');
// Using a simple factory method
$diff = JsonDiff::original('["json"]')->exclude(['key'])->compareTo('["different_json"]');
// Using a simple 'all-in-one' static method.
$diff = JsonDiff::compare($original = '["json"]', $new = '["different_json"]', $exclude = ['key']);
$diff->toArray();
[
'original' => ['...'],
'new' => ['...'],
'diff' => [
'added' => ['...'],
'removed' => ['...']
],
'changed' => true // or false if nothing changed
];
$diff->toJson(); // Json representation of toArray()
// All the properties can be accessed using array or object notation;
// original, new, added, removed, diff, changed.
$diff->diff;
$diff['diff'];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.