|
const | MAJOR_VERSION = 7 |
| The Guzzle major version.
|
|
◆ __construct()
GuzzleHttp\Client::__construct |
( |
array | $config = [] | ) |
|
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:
- handler: (callable) Function that transfers HTTP requests over the wire. The function is called with a Psr7\Http\Message\RequestInterface and array of transfer options, and must return a GuzzleHttp\Promise\PromiseInterface that is fulfilled with a Psr7\Http\Message\ResponseInterface on success. If no handler is provided, a default handler will be created that enables all of the request options below by attaching all of the default middleware to the handler.
- base_uri: (string|UriInterface) Base URI of the client that is merged into relative URIs. Can be a string or instance of UriInterface.
- **: any request option
- Parameters
-
array | $config | Client configuration settings. |
- See also
- GuzzleHttp\RequestOptions for a list of available request options.
Reimplemented in core\http_client.
◆ __call()
GuzzleHttp\Client::__call |
( |
| $method, |
|
|
| $args ) |
- Parameters
-
- Return values
-
PromiseInterface|ResponseInterface | |
- Deprecated
- Client\__call will be removed in guzzlehttp/guzzle:8.0.
◆ getConfig()
GuzzleHttp\Client::getConfig |
( |
string | $option = null | ) |
|
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.
- Parameters
-
string | null | $option | The config option to retrieve. |
- Return values
-
- Deprecated
- Client\getConfig will be removed in guzzlehttp/guzzle:8.0.
Implements GuzzleHttp\ClientInterface.
◆ request()
GuzzleHttp\Client::request |
( |
string | $method, |
|
|
| $uri = '', |
|
|
array | $options = [] ) |
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.
- Parameters
-
string | $method | HTTP method. |
string | UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. See GuzzleHttp\RequestOptions. |
- Exceptions
-
Implements GuzzleHttp\ClientInterface.
◆ requestAsync()
GuzzleHttp\Client::requestAsync |
( |
string | $method, |
|
|
| $uri = '', |
|
|
array | $options = [] ) |
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.
- Parameters
-
string | $method | HTTP method |
string | UriInterface | $uri | URI object or string. |
array | $options | Request options to apply. See GuzzleHttp\RequestOptions. |
Implements GuzzleHttp\ClientInterface.
◆ send()
◆ sendAsync()
◆ sendRequest()
The documentation for this class was generated from the following file:
- lib/guzzlehttp/guzzle/src/Client.php