Download the PHP package understeam/yii2-httpclient without Composer
On this page you can find all versions of the php package understeam/yii2-httpclient. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download understeam/yii2-httpclient
More information about understeam/yii2-httpclient
Files in understeam/yii2-httpclient
Package yii2-httpclient
Short Description Yii2 http client implementation based on Guzzle library
License GPL-v3
Informations about the package yii2-httpclient
Yii2 HTTP client
Installation
Recommended way to install this extenstion is through Composer:
Configuration
Add this lines to your config file:
Basic usage
Performing HTTP GET request with mime type detection:
You can disable this behavior by specifying $detectMimeType
option to whole component or single call
Make request with custom options:
Read more about this options in Guzzle 6 documentation
HTTP methods
You can make request with several ways:
- Call shortcut method (
get()
,post()
,put()
,delete()
, etc.) - Call
request()
method
All shortcut methods has the same signature except get()
:
NOTE: you still can make a GET request with body via
request()
function
Asynchronous calls
To make an asynchronous request simly add Async
to end of request method:
NOTE: mime type detection is not supported for asynchronous calls
Read more about asynchronous requests in Guzzle 6 documentation
Request body
Types you can pass as a body of request:
- Arrayable object (ActiveRecord, Model etc.) - will be encoded into JSON object
- Array - will be sent as form request (x-form-urlencoded)
Any other data passed as body will be sent into Guzzle without any transformations.
Read more about request body in Guzzle documentation
Appendix
Feel free to send feature requests and fix bugs with Pull Requests