debug

Summary

Set to true or set to a PHP stream returned by fopen() toenable debug output with the handler used to send a request. For example,when using cURL to transfer requests, cURL's verbose of CURLOPT_VERBOSEwill be emitted. When using the PHP stream wrapper, stream wrappernotifications will be emitted. If set to true, the output is written toPHP'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.  
  7. < HTTP/1.1 200 OK
  8. < Access-Control-Allow-Origin: *
  9. < Content-Type: application/json
  10. < Date: Sun, 16 Feb 2014 06:50:09 GMT
  11. < Server: gunicorn/0.17.4
  12. < Content-Length: 335
  13. < Connection: keep-alive
  14. <
  15. * Connection #0 to host httpbin.org left intact