$config
$config : array
__construct(array $config = array())
Clients accept an array of constructor parameters.
Here's an example of creating a client using a base_uri and an array of default request options to apply to each request:
$client = new Client([
'base_uri' => 'http://www.foo.com/1.0/',
'timeout' => 0,
'allow_redirects' => false,
'proxy' => '192.168.16.1:10'
]);
Client configuration settings include the following options:
array | $config | Client configuration settings. |
sendAsync(\Psr\Http\Message\RequestInterface $request, array $options = array()) : \GuzzleHttp\Promise\PromiseInterface
Asynchronously send an HTTP request.
\Psr\Http\Message\RequestInterface | $request | Request to send |
array | $options | Request options to apply to the given request and to the transfer. |
send(\Psr\Http\Message\RequestInterface $request, array $options = array()) : \Psr\Http\Message\ResponseInterface
Send an HTTP request.
\Psr\Http\Message\RequestInterface | $request | Request to send |
array | $options | Request options to apply to the given request and to the transfer. |
requestAsync(string $method, string|\Psr\Http\Message\UriInterface $uri = '', array $options = array()) : \GuzzleHttp\Promise\PromiseInterface
Create and send an asynchronous HTTP request.
Use an absolute path to override the base path of the client, or a relative path to append to the base path of the client. The URL can contain the query string as well. Use an array to provide a URL template and additional variables to use in the URL template expansion.
string | $method | HTTP method |
string|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
request(string $method, string|\Psr\Http\Message\UriInterface $uri = '', array $options = array()) : \Psr\Http\Message\ResponseInterface
Create and send an HTTP request.
Use an absolute path to override the base path of the client, or a relative path to append to the base path of the client. The URL can contain the query string as well.
string | $method | HTTP method. |
string|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
getConfig(string|null $option = null) : mixed
Get a client configuration option.
These options include default request options of the client, a "handler" (if utilized by the concrete client), and a "base_uri" if utilized by the concrete client.
string|null | $option | The config option to retrieve. |
transfer(\Psr\Http\Message\RequestInterface $request, array $options) : \GuzzleHttp\Promise\PromiseInterface
Transfers the given request and applies request options.
The URI of the request is not modified and the request options are used as-is without merging in default options.
\Psr\Http\Message\RequestInterface | $request | |
array | $options |
applyOptions(\Psr\Http\Message\RequestInterface $request, array $options) : \Psr\Http\Message\RequestInterface
Applies the array of request options to a request.
\Psr\Http\Message\RequestInterface | $request | |
array | $options |