debug

Summary

Set to true or set to a PHP stream returned by fopen() to enable debug output with the handler used to send a request. For example, when using cURL to transfer requests, cURL’s verbose of CURLOPT_VERBOSE will be emitted. When using the PHP stream wrapper, stream wrapper notifications will be emitted. If set to true, the output is written to PHP’s STDOUT. If a PHP stream is provided, output is written to the stream.

Types

  • bool
  • fopen() resource

Default

None

Constant

GuzzleHttp\RequestOptions::DEBUG

  1. $client->request('GET', '/get', ['debug' => true]);

Running the above example would output something like the following:

  1. * About to connect() to httpbin.org port 80 (#0)
  2. * Trying 107.21.213.98... * Connected to httpbin.org (107.21.213.98) port 80 (#0)
  3. > GET /get HTTP/1.1
  4. Host: httpbin.org
  5. User-Agent: Guzzle/4.0 curl/7.21.4 PHP/5.5.7
  6. < HTTP/1.1 200 OK
  7. < Access-Control-Allow-Origin: *
  8. < Content-Type: application/json
  9. < Date: Sun, 16 Feb 2014 06:50:09 GMT
  10. < Server: gunicorn/0.17.4
  11. < Content-Length: 335
  12. < Connection: keep-alive
  13. <
  14. * Connection #0 to host httpbin.org left intact