Interface Guzzle\Http\ClientInterface

ExtendsGuzzle\Common\HasDispatcherInterface
Implemented byGuzzle\Http\Client, Guzzle\Service\Client, Guzzle\Service\ClientInterface

Client interface for send HTTP requests

Public Methods

Hide inherited methods

MethodDescriptionDefined By
addSubscriber() Add an event subscriber to the dispatcher Guzzle\Common\HasDispatcherInterface
createRequest() Create and return a new {@see RequestInterface} configured for the client. Guzzle\Http\ClientInterface
delete() Create a DELETE request for the client Guzzle\Http\ClientInterface
dispatch() Helper to dispatch Guzzle events and set the event name on the event Guzzle\Common\HasDispatcherInterface
get() Create a GET request for the client Guzzle\Http\ClientInterface
getAllEvents() Get a list of all of the events emitted from the class Guzzle\Common\HasDispatcherInterface
getBaseUrl() Get the client's base URL as either an expanded or raw URI template Guzzle\Http\ClientInterface
getConfig() Get a configuration setting or all of the configuration settings. The Collection result of this method can be modified to change the configuration settings of a client. Guzzle\Http\ClientInterface
getEventDispatcher() Get the EventDispatcher of the request Guzzle\Common\HasDispatcherInterface
head() Create a HEAD request for the client Guzzle\Http\ClientInterface
options() Create an OPTIONS request for the client Guzzle\Http\ClientInterface
patch() Create a PATCH request for the client Guzzle\Http\ClientInterface
post() Create a POST request for the client Guzzle\Http\ClientInterface
put() Create a PUT request for the client Guzzle\Http\ClientInterface
send() Sends a single request or an array of requests in parallel Guzzle\Http\ClientInterface
setBaseUrl() Set the base URL of the client Guzzle\Http\ClientInterface
setConfig() Set the configuration object to use with the client Guzzle\Http\ClientInterface
setEventDispatcher() Set the EventDispatcher of the request Guzzle\Common\HasDispatcherInterface
setSslVerification() Set SSL verification options. Guzzle\Http\ClientInterface
setUserAgent() Set the User-Agent header to be used on all requests from the client Guzzle\Http\ClientInterface

Method Details

createRequest() public abstract method

Create and return a new {@see RequestInterface} configured for the client.

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 URI can contain the query string as well. Use an array to provide a URI template and additional variables to use in the URI template expansion.

public abstract Guzzle\Http\Message\RequestInterface createRequest ( $method = \Guzzle\Http\Message\RequestInterface::GET, $uri null, $headers null, $body null, array $options = [] )
$method string

HTTP method. Defaults to GET

$uri string|array

Resource URI.

$headers array|Guzzle\Common\Collection

HTTP headers

$body string|resource|array|Guzzle\Http\EntityBodyInterface

Entity body of request (POST/PUT) or response (GET)

$options array

Array of options to apply to the request

throws Guzzle\Common\Exception\InvalidArgumentException

if a URI array is passed that does not contain exactly two elements: the URI

                             followed by template variables
delete() public abstract method

Create a DELETE request for the client

See also \Guzzle\Http\Guzzle\Http\ClientInterface::createRequest().

public abstract Guzzle\Http\Message\EntityEnclosingRequestInterface delete ( $uri null, $headers null, $body null, array $options = [] )
$uri string|array

Resource URI

$headers array|Guzzle\Common\Collection

HTTP headers

$body string|resource|Guzzle\Http\EntityBodyInterface

Body to send in the request

$options array

Options to apply to the request

get() public abstract method

Create a GET request for the client

See also \Guzzle\Http\Guzzle\Http\ClientInterface::createRequest().

public abstract Guzzle\Http\Message\RequestInterface get ( $uri null, $headers null, $options = [] )
$uri string|array

Resource URI

$headers array|Guzzle\Common\Collection

HTTP headers

$options array

Options to apply to the request. For BC compatibility, you can also pass a

                             string to tell Guzzle to download the body of the response to a particular
                             location. Use the 'body' option instead for forward compatibility.
getBaseUrl() public abstract method

Get the client's base URL as either an expanded or raw URI template

public abstract string|null getBaseUrl ( $expand true )
$expand bool

Set to FALSE to get the raw base URL without URI template expansion

getConfig() public abstract method

Get a configuration setting or all of the configuration settings. The Collection result of this method can be modified to change the configuration settings of a client.

A client should honor the following special values:

  • request.options: Associative array of default RequestFactory options to apply to each request
  • request.params: Associative array of request parameters (data values) to apply to each request
  • curl.options: Associative array of cURL configuration settings to apply to each request
  • ssl.certificate_authority: Path a CAINFO, CAPATH, true to use strict defaults, or false to disable verification
  • redirect.disable: Set to true to disable redirects

See also Guzzle\Http\Message\RequestFactoryInterface::applyOptions() for a full list of request.options options.

public abstract mixed|Guzzle\Common\Collection getConfig ( $key false )
$key bool|string

Configuration value to retrieve. Set to FALSE to retrieve all values of the client.

                    The object return can be modified, and modifications will affect the client's config.
head() public abstract method

Create a HEAD request for the client

See also \Guzzle\Http\Guzzle\Http\ClientInterface::createRequest().

public abstract Guzzle\Http\Message\RequestInterface head ( $uri null, $headers null, array $options = [] )
$uri string|array

Resource URI

$headers array|Guzzle\Common\Collection

HTTP headers

$options array

Options to apply to the request

options() public abstract method

Create an OPTIONS request for the client

See also \Guzzle\Http\Guzzle\Http\ClientInterface::createRequest().

public abstract Guzzle\Http\Message\RequestInterface options ( $uri null, array $options = [] )
$uri string|array

Resource URI

$options array

Options to apply to the request

patch() public abstract method

Create a PATCH request for the client

See also \Guzzle\Http\Guzzle\Http\ClientInterface::createRequest().

public abstract Guzzle\Http\Message\EntityEnclosingRequestInterface patch ( $uri null, $headers null, $body null, array $options = [] )
$uri string|array

Resource URI

$headers array|Guzzle\Common\Collection

HTTP headers

$body string|resource|Guzzle\Http\EntityBodyInterface

Body to send in the request

$options array

Options to apply to the request

post() public abstract method

Create a POST request for the client

See also \Guzzle\Http\Guzzle\Http\ClientInterface::createRequest().

public abstract Guzzle\Http\Message\EntityEnclosingRequestInterface post ( $uri null, $headers null, $postBody null, array $options = [] )
$uri string|array

Resource URI

$headers array|Guzzle\Common\Collection

HTTP headers

$postBody array|Guzzle\Common\Collection|string|Guzzle\Http\EntityBodyInterface

POST body. Can be a string, EntityBody, or

                                               associative array of POST fields to send in the body of the
                                               request. Prefix a value in the array with the @ symbol to
                                               reference a file.
$options array

Options to apply to the request

put() public abstract method

Create a PUT request for the client

See also \Guzzle\Http\Guzzle\Http\ClientInterface::createRequest().

public abstract Guzzle\Http\Message\EntityEnclosingRequestInterface put ( $uri null, $headers null, $body null, array $options = [] )
$uri string|array

Resource URI

$headers array|Guzzle\Common\Collection

HTTP headers

$body string|resource|Guzzle\Http\EntityBodyInterface

Body to send in the request

$options array

Options to apply to the request

send() public abstract method

Sends a single request or an array of requests in parallel

public abstract Guzzle\Http\Message\Response|array send ( $requests )
$requests array|Guzzle\Http\Message\RequestInterface

One or more RequestInterface objects to send

return Guzzle\Http\Message\Response|array

Returns a single Response or an array of Response objects

setBaseUrl() public abstract method

Set the base URL of the client

public abstract self setBaseUrl ( $url )
$url string

The base service endpoint URL of the webservice

setConfig() public abstract method

Set the configuration object to use with the client

public abstract self setConfig ( $config )
$config array|Guzzle\Common\Collection

Parameters that define how the client behaves

setSslVerification() public abstract method

Set SSL verification options.

Setting $certificateAuthority to TRUE will result in the bundled cacert.pem being used to verify against the remote host.

Alternate certificates to verify against can be specified with the $certificateAuthority option set to the full path to a certificate file, or the path to a directory containing certificates.

Setting $certificateAuthority to FALSE will turn off peer verification, unset the bundled cacert.pem, and disable host verification. Please don't do this unless you really know what you're doing, and why you're doing it.

public abstract self setSslVerification ( $certificateAuthority true, $verifyPeer true, $verifyHost 2 )
$certificateAuthority string|bool

Bool, file path, or directory path

$verifyPeer bool

FALSE to stop from verifying the peer's certificate.

$verifyHost int

Set to 1 to check the existence of a common name in the SSL peer

                                     certificate. 2 to check the existence of a common name and also verify
                                     that it matches the hostname provided.
setUserAgent() public abstract method

Set the User-Agent header to be used on all requests from the client

public abstract self setUserAgent ( $userAgent, $includeDefault false )
$userAgent string

User agent string

$includeDefault bool

Set to true to prepend the value to Guzzle's default user agent string