1. Go to this page and download the library: Download fesor/json_matcher 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/ */
fesor / json_matcher example snippets
$alice = new User('Alice', 'Miller');
$john = new User('John', 'Smith');
$alice->addFriend($john);
$json = JsonMatcher::create(
json_encode($alice->toArrayIncludingFriends()), ['id', 'created_at']
);
$jsonResponse = JsonMatcher::create($response->getContent());
// or you can use factory instead
$jsonResponse = $matcherFactory->create($response->getContent());
// and there you go, for example you may use something like this
// for your gherkin steps implementations
$jsonResponse
->hasSize(1, ['at' => 'friends']) // checks that list of friends was incremented
->