nessworthy / amphp-http-httplug
A small crappy adapter package to support php-http/async-client-implementation via. amphp/http-client.
1.0.1
2021-04-27 07:39 UTC
Requires
- amphp/http-client: ^4.5
- amphp/http-client-psr7: dev-master
- php-http/httplug: ^2.2
- psr/http-factory-implementation: 1.0
- psr/http-message-implementation: 1.0
Requires (Dev)
- amphp/phpunit-util: ^1.4
- laminas/laminas-diactoros: ^2.5
- phpunit/phpunit: ^8.5
Suggests
Provides
This package is auto-updated.
Last update: 2024-10-27 15:23:29 UTC
README
Not recognised or endorsed by AMPHP. Would not say it's that good either.
Have a package that requires php-http/client-implementation
, but you're running AMP? Here's the solution!
Requirements
- PHP >= 7.2
- An implementation of
psr/http-factory-implementation
andpsr/http-message-implementation
. I recommendlaminas/laminas-diactoros
because it has a name that's 100% impossible to remember, and it's a damn good package. - AMPHP (duh).
Usage:
// Implementations of request/response factory interfaces. Are not bundled with this package! use Laminas\Diactoros\RequestFactory; use Laminas\Diactoros\ResponseFactory; use Amp\Http\Client\Psr7\PsrAdapter; use Nessworthy\AmpHttpPlug\AmpHttpClientAdapter; use Amp\Http\Client\HttpClientBuilder; $httpClient = HttpClientBuilder::buildDefault(); $psrAdapter = new PsrAdapter( new RequestFactory, new ResponseFactory ); // Implements async and non-async interfaces. $adapter = new AmpHttpClientAdapter( $httpClient, $psrAdapter );