Artax Adapter

An HTTPlug adapter for the Artax HTTP client.

Installation

To install the Artax adapter, which will also install Artax itself (if it was not yet included in your project), run:

$ composer require php-http/artax-adapter

Usage

Begin by creating a Artax adapter:

use Amp\Artax\DefaultClient;
use Http\Adapter\Artax\Client as ArtaxAdapter;
use Http\Message\MessageFactory\GuzzleMessageFactory;

$adapter = new ArtaxAdapter(new DefaultClient(), new GuzzleMessageFactory());

Or relying on discovery:

use Http\Adapter\Artax\Client as ArtaxAdapter;

$adapter = new ArtaxAdapter();

Further reading

  • Use plugins to customize the way HTTP requests are sent and responses processed by following redirects, adding Authentication or Cookie headers and more.

  • Learn how you can decouple your code from any PSR-7 implementation by using the HTTP factories.

  • Read more about promises when using asynchronous requests.