getTransferTime() is public method (getter), try that.
$response->transferStats->getTransferTime()
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I read over the docs and I cannot find a way to get the total time it takes for a request to execute, Im logging this to get an idea of how long it takes for an API to respond, any help will be greatly appreciated.
When I try
$response->transferStats->transferTime
I get "Cannot access private property GuzzleHttp\TransferStats::$transferTime"
And the above gives me the info I need.
I have also tried the withOptions and added array:
'on_stats' => function (TransferStats $stats) { return $stats->getTransferTime(); }
But I get error: Second array member is not a valid method
getTransferTime() is public method (getter), try that.
$response->transferStats->getTransferTime()
Please or to participate in this conversation.