Skip to content

Add docs for artax-adapter #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 13, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions clients.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface and forwarding the calls to an HTTP client not implementing the interf
clients/curl-client
clients/socket-client
clients/mock-client
clients/artax-adapter
clients/buzz-adapter
clients/cakephp-adapter
clients/guzzle5-adapter
Expand All @@ -30,6 +31,7 @@ interface and forwarding the calls to an HTTP client not implementing the interf
"``php-http/curl-client``", "Client", ":doc:`Docs </clients/curl-client>`, `Repo <https://github.com/php-http/curl-client>`__", "|curl_version| |curl_downloads| "
"``php-http/socket-client``", "Client", ":doc:`Docs </clients/socket-client>`, `Repo <https://github.com/php-http/socket-client>`__", "|socket_version| |socket_downloads| "
"``php-http/mock-client``", "Client", ":doc:`Docs </clients/mock-client>`, `Repo <https://github.com/php-http/mock-client>`__", "|mock_version| |mock_downloads| "
"``php-http/artax-adapter``", "Adapter", ":doc:`Docs </clients/artax-adapter>`, `Repo <https://github.com/php-http/artax-adapter>`__", "|artax_version| |artax_downloads| "
"``php-http/buzz-adapter``", "Adapter", ":doc:`Docs </clients/buzz-adapter>`, `Repo <https://github.com/php-http/buzz-adapter>`__", "|buzz_version| |buzz_downloads| "
"``php-http/cakephp-adapter``", "Adapter", ":doc:`Docs </clients/cakephp-adapter>`, `Repo <https://github.com/php-http/cakephp-adapter>`__", "|cakephp_version| |cakephp_downloads| "
"``php-http/guzzle5-adapter``", "Adapter", ":doc:`Docs </clients/guzzle5-adapter>`, `Repo <https://github.com/php-http/guzzle5-adapter>`__", "|guzzle5_version| |guzzle5_downloads| "
Expand Down Expand Up @@ -74,6 +76,13 @@ HTTPlug use the ``provide`` section to tell composer that they do provide the cl
:target: https://github.com/php-http/mock-client/releases
:alt: Latest Version

.. |artax_downloads| image:: https://img.shields.io/packagist/dt/php-http/artax-adapter.svg?style=flat-square
:target: https://packagist.org/packages/php-http/artax-adapter
:alt: Total Downloads
.. |artax_version| image:: https://img.shields.io/github/release/php-http/artax-adapter.svg?style=flat-square
:target: https://github.com/php-http/artax-adapter/releases
:alt: Latest Version

.. |buzz_downloads| image:: https://img.shields.io/packagist/dt/php-http/buzz-adapter.svg?style=flat-square
:target: https://packagist.org/packages/php-http/buzz-adapter
:alt: Total Downloads
Expand Down
43 changes: 43 additions & 0 deletions clients/artax-adapter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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:

.. code-block:: bash

$ composer require php-http/artax-adapter

.. include:: includes/install-message-factory.inc

.. include:: includes/install-discovery.inc

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 if you installed the :doc:`discovery </discovery>` layer::

use Http\Adapter\Artax\Client as ArtaxAdapter;

$adapter = new ArtaxAdapter();

.. warning::

The message factory parameter is mandatory if the discovery layer is not installed.

.. include:: includes/further-reading-sync.inc

.. _Artax HTTP client: https://github.com/amphp/artax