Skip to content

Repository files navigation

Latest Stable VersionTotal DownloadsLicensePHP

webclient/webclient

Simple HTTP client without cURL dependency.

Install

Install this package, your favorite psr-7 implementation and your favorite psr-17 implementation.

composer require webclient/webclient:^1.0

Using

<?phpuseWebclient\Http\Webclient;
usePsr\Http\Message\RequestInterface;
usePsr\Http\Message\ResponseFactoryInterface;
usePsr\Http\Message\StreamFactoryInterface;
/**  * @var ResponseFactoryInterface $responseFactory * @var StreamFactoryInterface $streamFactory */$http = newWebclient($responseFactory, $streamFactory);
/** @var RequestInterface $request */$response = $http->sendRequest($request);
$code = $response->getStatusCode();
$phrase = $response->getReasonPhrase();
$headers = $response->getHeaders();
$someHeader = $response->getHeader('Content-Type');
$body = $response->getBody()->__toString();

Extensions

About

Simple HTTP client without cURL dependency

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages