Documentation

ClientInterface

Client interface for sending HTTP requests.

Table of Contents

MAJOR_VERSION  = 7
The Guzzle major version.
getConfig()  : mixed
Get a client configuration option.
request()  : ResponseInterface
Create and send an HTTP request.
requestAsync()  : PromiseInterface
Create and send an asynchronous HTTP request.
send()  : ResponseInterface
Send an HTTP request.
sendAsync()  : PromiseInterface
Asynchronously send an HTTP request.

Constants

MAJOR_VERSION

The Guzzle major version.

public mixed MAJOR_VERSION = 7

Methods

getConfig()

Get a client configuration option.

public getConfig([string|null $option = null ]) : mixed

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
$option : string|null = null

The config option to retrieve.

Tags
deprecated

ClientInterface::getConfig will be removed in guzzlehttp/guzzle:8.0.

Return values
mixed

request()

Create and send an HTTP request.

public request(string $method, string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : ResponseInterface

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
$method : string

HTTP method.

$uri : string|UriInterface

URI object or string.

$options : array<string|int, mixed> = []

Request options to apply.

Tags
throws
GuzzleException
Return values
ResponseInterface

requestAsync()

Create and send an asynchronous HTTP request.

public requestAsync(string $method, string|UriInterface $uri[, array<string|int, mixed> $options = [] ]) : PromiseInterface

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
$method : string

HTTP method

$uri : string|UriInterface

URI object or string.

$options : array<string|int, mixed> = []

Request options to apply.

Return values
PromiseInterface

Search results