Can Guzzle send asynchronous requests?

Yes. You can use the requestAsync, sendAsync, getAsync, headAsync, putAsync, postAsync, deleteAsync, and patchAsync methods of a client to send an asynchronous request. The client will return a GuzzleHttp\Promise\PromiseInterface object. You can chain then functions off of the promise.

  1. $promise = $client->requestAsync('GET', 'http://httpbin.org/get');
  2. $promise->then(function ($response) {
  3. echo 'Got a response! ' . $response->getStatusCode();
  4. });

You can force an asynchronous response to complete using the wait() method of the returned promise.

  1. $promise = $client->requestAsync('GET', 'http://httpbin.org/get');
  2. $response = $promise->wait();