Download the PHP package amphp/http-client-psr7 without Composer
On this page you can find all versions of the php package amphp/http-client-psr7. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download amphp/http-client-psr7
More information about amphp/http-client-psr7
Files in amphp/http-client-psr7
Package http-client-psr7
Short Description PSR-7 adapter for Amp's HTTP client.
License MIT
Homepage https://github.com/amphp/http-client-psr7
Informations about the package http-client-psr7
amphp/http-client-psr7
AMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind.
This package provides an PSR-7 adapter and PSR-18 client as a plugin for amphp/http-client
.
Installation
This package can be installed as a Composer dependency.
Requirements
- PHP 8.1+
Usage
Create Amp\Http\Client\Psr7\PsrAdapter
instance to convert client requests and responses between native Amp and PSR-7 formats. Adapter doesn't depend on any concrete PSR-7 implementation, so it requires PSR-17 factory interfaces to create PSR-7 requests and responses.
Use Amp\Http\Client\Psr7\PsrHttpClient
as a drop-in implementation of a PSR-18 ClientInterface
.
There are few incompatibilities between Amp and PSR-7 implementations that may require special handling:
- PSR-7 requests contain only one protocol version, but Amp requests can contain several versions. In this case the adapter checks if the protocol version list contains a version that is the current PSR-7 implementation default, otherwise it throws an exception. You may also set the protocol version explicitly using the optional argument of the
toPsrRequest()
method. - Amp responses contain a reference to the
Request
instance, but PSR-7 responses don't; so you need to provide a request instance explicitly.
Examples
More extensive code examples reside in the examples
directory.
Versioning
amphp/http-client-psr7
follows the semver semantic versioning specification like all other amphp
packages.
Security
If you discover any security related issues, please use the private security issue reporter instead of using the public issue tracker.
License
The MIT License (MIT). Please see LICENSE
for more information.
All versions of http-client-psr7 with dependencies
amphp/amp Version ^3
amphp/byte-stream Version ^2
amphp/http-client Version ^5
psr/http-message Version ^1.1 || ^2
psr/http-factory Version ^1
psr/http-client Version ^1
psr/http-factory-implementation Version ^1
revolt/event-loop Version ^1