Skip to content

Latest commit

 

History

History
152 lines (110 loc) · 4.36 KB

index.rst

File metadata and controls

152 lines (110 loc) · 4.36 KB

PHP-HTTP: standardized HTTP for PHP

HTTPlug Logo

PHP-HTTP is the next step in standardizing HTTP interaction for PHP packages.

It builds on top of PSR-7_, which defines interfaces for HTTP requests and responses. The HTTPlug HTTP client interface has been standardized in PSR-18_ to define synchronous HTTP requests. When using a client that implements PSR-18, we recommend directly using PSR-18 and not HTTPlug nor our adapters.

However, PSR-18 does not define asynchronous requests. HTTPlug provides interfaces for those, but to do that also needs to define how :doc:`promises <components/promise>` are implemented.

PHP-HTTP has three goals:

  1. Encourage package developers to depend on the simple HTTPlug interface instead of concrete HTTP clients.
  2. Provide good quality HTTP-related packages to the PHP community.
  3. Now that PSR-18 exists, we miss a PSR for asynchronous requests. This is blocked by not having a PSR for promises.

HTTPlug

HTTPlug abstracts from HTTP clients written in PHP, offering a simple interface. It also provides an implementation-independent plugin system to build pipelines regardless of the HTTP client implementation used.

Read more about :doc:`HTTPlug </httplug/introduction>`.

They use us

Geocoder Mailgun FOSHttpCache KnpLabs Sentry HWIOAuthBundle

Packages

PHP-HTTP offers several packages:

Type Description Namespace
Clients HTTP clients: Socket, cURL and others Http\Client\[Name]
Client adapters Adapters for other clients: Guzzle, React and others Http\Adapter\[Name]
Plugins Implementation-independent authentication, cookies and more Http\Client\Common\Plugin\[Name]

Read more about :doc:`clients and adapters <clients>` and :doc:`plugins <plugins/index>`.

The future

HTTPlug, as a working example of an HTTP client interface, can serve as a basis for discussion around a future HTTP client PSR.

Community

If you want to get in touch, feel free to ask questions on our Slack channel or ping @httplug on Twitter.

.. toctree::
    :hidden:

    PHP-HTTP <self>

.. toctree::
   :hidden:
   :caption: HTTPlug
   :maxdepth: 4

   Introduction <httplug/introduction>
   Usage <httplug/usage>
   Exceptions <httplug/exceptions>
   Tutorial <httplug/tutorial>
   Migrating <httplug/migrating>

   clients
   plugins/index

   integrations/index

   Backwards compatibility <httplug/backwards-compatibility>

.. toctree::
   :hidden:
   :caption: Components

   message
   components/client-common
   components/adapter-integration-tests
   components/promise
   discovery
   components/multipart-stream-builder

.. toctree::
   :hidden:
   :caption: ---------

   development/index.rst