progress

Summary

Defines a function to invoke when transfer progress is made.

Types

  • callable

Default

None

Constant

GuzzleHttp\RequestOptions::PROGRESS

The function accepts the following positional arguments:

  • the total number of bytes expected to be downloaded, zero if unknown
  • the number of bytes downloaded so far
  • the total number of bytes expected to be uploaded
  • the number of bytes uploaded so far
1. // Send a GET request to /get?foo=bar
2. $result = $client->request(
3. 'GET',
4. '/',
5. [
6. 'progress' => function(
7. $downloadTotal,
8. $downloadedBytes,
9. $uploadTotal,
10. $uploadedBytes
11. ) {
12. //do something
13. },
14. ]
15. );