PHP code example of germania-kg / jsondecoder
1. Go to this page and download the library: Download germania-kg/jsondecoder 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/ */
germania-kg / jsondecoder example snippets
use Germania\JsonDecoder\JsonDecoder;
// Let:
// $response instance of ResponseInterface,
// $body instance of StreamInterface
$body = $response->getBody();
$str = $body->__toString();
try {
$decoder = new JsonDecoder;
$decoded = $decoder( $response );
$decoded = $decoder( $body );
$decoded = $decoder( $str );
}
catch ( \JsonException $e)
{
echo $e->getMessage();
}