HttpAsyncClient.php 682 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Http\Client;
  3. use Http\Promise\Promise;
  4. use Psr\Http\Message\RequestInterface;
  5. /**
  6. * Sends a PSR-7 Request in an asynchronous way by returning a Promise.
  7. *
  8. * @author Joel Wurtz <joel.wurtz@gmail.com>
  9. */
  10. interface HttpAsyncClient
  11. {
  12. /**
  13. * Sends a PSR-7 request in an asynchronous way.
  14. *
  15. * Exceptions related to processing the request are available from the returned Promise.
  16. *
  17. * @return Promise resolves a PSR-7 Response or fails with an Http\Client\Exception
  18. *
  19. * @throws \Exception If processing the request is impossible (eg. bad configuration).
  20. */
  21. public function sendAsyncRequest(RequestInterface $request);
  22. }