Download the PHP package borsch/http-client without Composer
On this page you can find all versions of the php package borsch/http-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download borsch/http-client
More information about borsch/http-client
Files in borsch/http-client
Package http-client
Short Description An implementation of PSR-18 HTTP Client.
License MIT
Informations about the package http-client
Borsch - HTTP Client
A simple implementation of PSR-18 HTTP Client.
This package is part of the Borsch framework.
Installation
Via Composer :
Usage
Methods
->setResponseClassName(): Client
You MUST provide an implementation of a PSR-7 ResponseInterface.
Borsch\Http\Client will then use this implementation to create a response instance.
For example, if you are using Slim PHP PSR-7 implementation, your code should look like this :
An implementation of a PSR-17 ResponseFactoryInterface can also be provided, example with Nyholm/psr7 :
Borsch\Http\Client will call method createResponse()
to get the ResponseInterface instance.
->getResponseClassName(): string
Return the ResponseInterface or ResponseFactoryInterface provided in method setResponseClassName()
.
->setCurlOption(int $option, $value): Client
Borsch\Http\Client uses cURL, therefore you can supply some option before sending the request. Borsch\Http\Client already sets these options with values from the request so you will not be able to override them :
- CURLOPT_CUSTOMREQUEST
- CURLOPT_URL
- CURLOPT_HTTP_VERSION
- CURLOPT_POSTFIELDS
- CURLOPT_HTTPHEADER
- CURLOPT_RETURNTRANSFER
- CURLOPT_ENCODING
- CURLOPT_HEADERFUNCTION
Example :
->setCurlOptions(array $options): Client
Set many cURL options at once with the provided array.
Must be of the form :
->getCurlOptions(): array
Get cURL options you've set.