diff --git a/.gitignore b/.gitignore index 9fd1dab..f7f520e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea /vendor/ +composer.lock diff --git a/composer.json b/composer.json index 19f4271..4999e52 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "*" + "phpunit/phpunit": "*", + "guzzlehttp/guzzle": "^6" }, "autoload" : { "psr-4": {"JsonMachine\\": "src/"} diff --git a/src/examples/guzzleHttp.php b/src/examples/guzzleHttp.php index 43dd748..e47f4e8 100644 --- a/src/examples/guzzleHttp.php +++ b/src/examples/guzzleHttp.php @@ -6,6 +6,6 @@ $client = new \GuzzleHttp\Client(); $respose = $client->request('GET', 'https://httpbin.org/anything?key=value'); // Gets PHP stream resource from Guzzle stream $phpStream = \GuzzleHttp\Psr7\StreamWrapper::getResource($respose->getBody()); -$result = iterator_to_array(\JsonMachine\JsonMachine::fromStream($phpStream)); - -assert($result['args'] == ['key' => 'value']); +foreach (\JsonMachine\JsonMachine::fromStream($phpStream) as $key => $value) { + var_dump([$key, $value]); +}