Handling guzzle 6 response body in laravel
<p>I'm making a Laravel 5.2 project which is communicating with a local API. And I'm having issues handling the Guzzle response body. </p>

<p>My controller:</p>

<pre><code>public function getClients(){
    $guzzle = new Client();
    try{

        $response = $guzzle-&gt;request('GET', 'http://localhost:3000/client')-&gt;getBody();           
        return view('home.clients', ['clients' =&gt; $response]);

    }catch(ClientException $e){
     //Handling the exception
    }
}
</code></pre>

<p>My blade View:</p>

<pre><code>&lt;h2&gt;Client list&lt;/h2&gt;

{{ $clients }}//Just to inspect it

@forelse ($clients as $client)
    &lt;h3&gt;{{ $client-&gt;name }}&lt;/h3&gt;
    &lt;h3&gt;{{ $client-&gt;email }}&lt;/h3&gt;
    &lt;h3&gt;{{ $client-&gt;country }}&lt;/h3&gt;
@empty
    &lt;h3&gt;No clients here&lt;/h3&gt;
@endforelse
</code></pre>

<p>No errors on the loop or the controller, also is showing the Stream Object in the browser but in the loop doesn't display anything.</p>

<p>I've already read the Guzzle 6 response body documentation, but it's not that clear for a newbie in this like me.</p>

<p>Thoughts?</p>

<p><strong>Browser output:</strong>
<img src="https://i.stack.imgur.com/3HFvq.png" alt="browser output"></p>