$config
$config : array
$config : array
request(string $method, string|\Psr\Http\Message\UriInterface $uri = '', array $options = []) : \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. See \GuzzleHttp\RequestOptions. |
get(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \Psr\Http\Message\ResponseInterface
Create and send an HTTP GET 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
head(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \Psr\Http\Message\ResponseInterface
Create and send an HTTP HEAD 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
put(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \Psr\Http\Message\ResponseInterface
Create and send an HTTP PUT 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
post(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \Psr\Http\Message\ResponseInterface
Create and send an HTTP POST 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
patch(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \Psr\Http\Message\ResponseInterface
Create and send an HTTP PATCH 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
delete(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \Psr\Http\Message\ResponseInterface
Create and send an HTTP DELETE 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
requestAsync(string $method, string|\Psr\Http\Message\UriInterface $uri = '', array $options = []) : \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. See \GuzzleHttp\RequestOptions. |
getAsync(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \GuzzleHttp\Promise\PromiseInterface
Create and send an asynchronous HTTP GET 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
headAsync(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \GuzzleHttp\Promise\PromiseInterface
Create and send an asynchronous HTTP HEAD 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
putAsync(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \GuzzleHttp\Promise\PromiseInterface
Create and send an asynchronous HTTP PUT 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
postAsync(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \GuzzleHttp\Promise\PromiseInterface
Create and send an asynchronous HTTP POST 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
patchAsync(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \GuzzleHttp\Promise\PromiseInterface
Create and send an asynchronous HTTP PATCH 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
deleteAsync(string|\Psr\Http\Message\UriInterface $uri, array $options = []) : \GuzzleHttp\Promise\PromiseInterface
Create and send an asynchronous HTTP DELETE 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|\Psr\Http\Message\UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. |
__construct(array $config = []) : mixed
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 = []) : \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. See \GuzzleHttp\RequestOptions. |
None found |
send(\Psr\Http\Message\RequestInterface $request, array $options = []) : \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. See \GuzzleHttp\RequestOptions. |
None found |
sendRequest(\Psr\Http\Message\RequestInterface $request) : \Psr\Http\Message\ResponseInterface
The HttpClient PSR (PSR-18) specify this method.
\Psr\Http\Message\RequestInterface | $request |
inheritDoc |
---|
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. |
None found |
buildUri(\Psr\Http\Message\UriInterface $uri, array $config) : \Psr\Http\Message\UriInterface
\Psr\Http\Message\UriInterface | $uri | |
array | $config |
None found |
configureDefaults(array $config) : void
Configures the default options for a client.
array | $config |
None found |
prepareDefaults(array $options) : array
Merges default options into the array.
array | $options | Options to modify by reference |
None found |
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 | See \GuzzleHttp\RequestOptions. |
None found |
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 |
None found |
invalidBody() : \GuzzleHttp\Exception\InvalidArgumentException
Return an InvalidArgumentException with pre-set message.
None found |