stream

Summary
Set to true to stream a response rather than download it allup-front.
Types
bool
Default
false
Constant
GuzzleHttp\RequestOptions::STREAM
  1. $response = $client->request('GET', '/stream/20', ['stream' => true]);
  2. // Read bytes off of the stream until the end of the stream is reached
  3. $body = $response->getBody();
  4. while (!$body->eof()) {
  5. echo $body->read(1024);
  6. }

Note

Streaming response support must be implemented by the HTTP handler used bya client. This option might not be supported by every HTTP handler, but theinterface of the response object remains the same regardless of whether ornot it is supported by the handler.