PHP code example of lindelius / php-json-patch
1. Go to this page and download the library: Download lindelius/php-json-patch 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/ */
lindelius / php-json-patch example snippets
// Option 1: Provide the raw JSON string
$newDocument = $patcher->patchFromJson($documentAsArray, $operationsAsJson);
// Option 2: Provide the JSON Patch operations in array format
$newDocument = $patcher->patch($documentAsArray, $operationsAsArray);
$patcher->addProtectedPath("/id");
$patcher->addProtectedPath("/created_at");
$patcher->addProtectedPath("/some/nested/path");
composer