Guzzle 6 - Get request total time

Benoth picture Benoth · Jul 10, 2015 · Viewed 11.5k times · Source

I'm searching to retrieve the request total time in Guzzle 6, just after a simple GET request :

$client = new GuzzleHttp\Client();
$response = client->get('http://www.google.com/');

But can't find anything in the docs about that. Any idea ?

Thanks a lot.

Answer

Michael picture Michael · Sep 18, 2015

In Guzzle 6.1.0 You can use the 'on_stats' request option to get transfer time etc.

More information can be found at Request Options - on_stats

https://github.com/guzzle/guzzle/releases/tag/6.1.0