NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Interface ClientInterface

Client interface for send HTTP requests

  Guzzle\Http\ClientInterface implements Guzzle\Common\HasDispatcherInterface

### Direct known implementers

`Guzzle\Http\Client`, `Guzzle\Service\ClientInterface`

### Indirect known implementers

`Aws\AutoScaling\AutoScalingClient`, `Aws\CloudFormation\CloudFormationClient`, `Aws\CloudWatchLogs\CloudWatchLogsClient`, `Aws\CodeCommit\CodeCommitClient`, `Aws\CodeDeploy\CodeDeployClient`, `Aws\CodePipeline\CodePipelineClient`, `Aws\CognitoIdentity\CognitoIdentityClient`, `Aws\CognitoSync\CognitoSyncClient`, `Aws\Common\Client\AbstractClient`, `Aws\Common\Client\AwsClientInterface`, `Aws\Common\Client\DefaultClient`, `Aws\Common\InstanceMetadata\InstanceMetadataClient`, `Aws\CloudFront\CloudFrontClient`, `Aws\ConfigService\ConfigServiceClient`, `Aws\DataPipeline\DataPipelineClient`, `Aws\DeviceFarm\DeviceFarmClient`, `Aws\DirectConnect\DirectConnectClient`, `Aws\DirectoryService\DirectoryServiceClient`, `Aws\DynamoDb\DynamoDbClient`, `Aws\DynamoDb_2011_12_05\DynamoDbClient`, `Aws\DynamoDbStreams\DynamoDbStreamsClient`, `Aws\Ec2\Ec2Client`, `Aws\Ecs\EcsClient`, `Aws\CloudFront_2012_05_05\CloudFrontClient`, `Aws\Efs\EfsClient`, `Aws\ElastiCache\ElastiCacheClient`, `Aws\ElasticBeanstalk\ElasticBeanstalkClient`, `Aws\ElasticFileSystem\ElasticFileSystemClient`, `Aws\ElasticLoadBalancing\ElasticLoadBalancingClient`, `Aws\ElasticTranscoder\ElasticTranscoderClient`, `Aws\Emr\EmrClient`, `Aws\Glacier\GlacierClient`, `Aws\Iam\IamClient`, `Aws\ImportExport\ImportExportClient`, `Aws\CloudHsm\CloudHsmClient`, `Aws\Kinesis\KinesisClient`, `Aws\Kms\KmsClient`, `Aws\Lambda\LambdaClient`, `Aws\MachineLearning\MachineLearningClient`, `Aws\OpsWorks\OpsWorksClient`, `Aws\Rds\RdsClient`, `Aws\Redshift\RedshiftClient`, `Aws\Route53\Route53Client`, `Aws\Route53Domains\Route53DomainsClient`, `Aws\S3\S3Client`, `Aws\CloudSearch\CloudSearchClient`, `Aws\Ses\SesClient`, `Aws\SimpleDb\SimpleDbClient`, `Aws\Sns\SnsClient`, `Aws\Sqs\SqsClient`, `Aws\Ssm\SsmClient`, `Aws\StorageGateway\StorageGatewayClient`, `Aws\Sts\StsClient`, `Aws\Support\SupportClient`, `Aws\Swf\SwfClient`, `Aws\WorkSpaces\WorkSpacesClient`, `Aws\CloudSearch_2011_02_01\CloudSearchClient`, `Guzzle\Service\Client`, `Aws\CloudSearchDomain\CloudSearchDomainClient`, `Aws\CloudTrail\CloudTrailClient`, `Aws\CloudWatch\CloudWatchClient`

Namespace: Guzzle\Http
Located at Guzzle/Http/ClientInterface.php

## Methods summary

- `public` `setConfig ( array|Collection $config )`

  Set the configuration object to use with the client

- `public` `getConfig ( bool|string $key = false )`

  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.

- `public` `createRequest ( string $method = Guzzle\Http\RequestInterface::GET, string|array $uri = null, array|Collection $headers = null, string|resource|array|EntityBodyInterface $body = null, array $options = array() )`

  Create and return a new `Guzzle\Http\Message\RequestInterface` configured for the client.

- `public` `get ( string|array $uri = null, array|Collection $headers = null, array $options = array() )`

  Create a GET request for the client

- `public` `head ( string|array $uri = null, array|Collection $headers = null, array $options = array() )`

  Create a HEAD request for the client

- `public` `delete ( string|array $uri = null, array|Collection $headers = null, string|resource|EntityBodyInterface $body = null, array $options = array() )`

  Create a DELETE request for the client

- `public` `put ( string|array $uri = null, array|Collection $headers = null, string|resource|EntityBodyInterface $body = null, array $options = array() )`

  Create a PUT request for the client

- `public` `patch ( string|array $uri = null, array|Collection $headers = null, string|resource|EntityBodyInterface $body = null, array $options = array() )`

  Create a PATCH request for the client

- `public` `post ( string|array $uri = null, array|Collection $headers = null, array|Collection|string|EntityBodyInterface $postBody = null, array $options = array() )`

  Create a POST request for the client

- `public` `options ( string|array $uri = null, array $options = array() )`

  Create an OPTIONS request for the client

- `public` `send ( array|RequestInterface $requests )`

  Sends a single request or an array of requests in parallel

- `public` `getBaseUrl ( bool $expand = true )`

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

- `public` `setBaseUrl ( string $url )`

  Set the base URL of the client

- `public` `setUserAgent ( string $userAgent, bool $includeDefault = false )`

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

- `public` `setSslVerification ( string|bool $certificateAuthority = true, bool $verifyPeer = true, int $verifyHost = 2 )`

  Set SSL verification options.

## Methods detail

# `public `Guzzle\Http\ClientInterface``
`setConfig( array|`Guzzle\Common\Collection` $config )`

Set the configuration object to use with the client

#### Parameters

$config
  `array|`Guzzle\Common\Collection``
  $config Parameters that define how the client behaves

#### Returns

``Guzzle\Http\ClientInterface``
# `public mixed|`Guzzle\Common\Collection``
`getConfig( boolean|string $key = false )`

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

#### Parameters

$key
  `boolean|string`
  $key 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.

#### Returns

`mixed|`Guzzle\Common\Collection``

#### See

\Guzzle\Http\Message\RequestFactoryInterface::applyOptions for a full list of request.options options
# `public `Guzzle\Http\Message\RequestInterface``
`createRequest( string $method = Guzzle\Http\RequestInterface::GET, string|array $uri = null, array|`Guzzle\Common\Collection` $headers = null, string|resource|array|`Guzzle\Http\EntityBodyInterface` $body = null, array $options = array() )`

Create and return a new `Guzzle\Http\Message\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.

#### Parameters

$method
  `string`
  $method HTTP method. Defaults to GET
$uri
  `string|array`
  $uri Resource URI.
$headers
  `array|`Guzzle\Common\Collection``
  $headers HTTP headers
$body
  `string|resource|array|`Guzzle\Http\EntityBodyInterface``
  $body Entity body of request (POST/PUT) or response (GET)
$options
  `array`
  $options Array of options to apply to the request

#### Returns

``Guzzle\Http\Message\RequestInterface``

#### Throws

``Guzzle\Common\Exception\InvalidArgumentException``
if a URI array is passed that does not contain exactly two elements: the URI followed by template variables
# `public `Guzzle\Http\Message\RequestInterface``
`get( string|array $uri = null, array|`Guzzle\Common\Collection` $headers = null, array $options = array() )`

Create a GET request for the client

#### Parameters

$uri
  `string|array`
  $uri Resource URI
$headers
  `array|`Guzzle\Common\Collection``
  $headers HTTP headers
$options
  `array`
  $options 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.

#### Returns

``Guzzle\Http\Message\RequestInterface``

#### See

``Guzzle\Http\ClientInterface::createRequest()``
# `public `Guzzle\Http\Message\RequestInterface``
`head( string|array $uri = null, array|`Guzzle\Common\Collection` $headers = null, array $options = array() )`

Create a HEAD request for the client

#### Parameters

$uri
  `string|array`
  $uri Resource URI
$headers
  `array|`Guzzle\Common\Collection``
  $headers HTTP headers
$options
  `array`
  $options Options to apply to the request

#### Returns

``Guzzle\Http\Message\RequestInterface``

#### See

``Guzzle\Http\ClientInterface::createRequest()``
# `public `Guzzle\Http\Message\EntityEnclosingRequestInterface``
`delete( string|array $uri = null, array|`Guzzle\Common\Collection` $headers = null, string|resource|`Guzzle\Http\EntityBodyInterface` $body = null, array $options = array() )`

Create a DELETE request for the client

#### Parameters

$uri
  `string|array`
  $uri Resource URI
$headers
  `array|`Guzzle\Common\Collection``
  $headers HTTP headers
$body
  `string|resource|`Guzzle\Http\EntityBodyInterface``
  $body Body to send in the request
$options
  `array`
  $options Options to apply to the request

#### Returns

``Guzzle\Http\Message\EntityEnclosingRequestInterface``

#### See

``Guzzle\Http\ClientInterface::createRequest()``
# `public `Guzzle\Http\Message\EntityEnclosingRequestInterface``
`put( string|array $uri = null, array|`Guzzle\Common\Collection` $headers = null, string|resource|`Guzzle\Http\EntityBodyInterface` $body = null, array $options = array() )`

Create a PUT request for the client

#### Parameters

$uri
  `string|array`
  $uri Resource URI
$headers
  `array|`Guzzle\Common\Collection``
  $headers HTTP headers
$body
  `string|resource|`Guzzle\Http\EntityBodyInterface``
  $body Body to send in the request
$options
  `array`
  $options Options to apply to the request

#### Returns

``Guzzle\Http\Message\EntityEnclosingRequestInterface``

#### See

``Guzzle\Http\ClientInterface::createRequest()``
# `public `Guzzle\Http\Message\EntityEnclosingRequestInterface``
`patch( string|array $uri = null, array|`Guzzle\Common\Collection` $headers = null, string|resource|`Guzzle\Http\EntityBodyInterface` $body = null, array $options = array() )`

Create a PATCH request for the client

#### Parameters

$uri
  `string|array`
  $uri Resource URI
$headers
  `array|`Guzzle\Common\Collection``
  $headers HTTP headers
$body
  `string|resource|`Guzzle\Http\EntityBodyInterface``
  $body Body to send in the request
$options
  `array`
  $options Options to apply to the request

#### Returns

``Guzzle\Http\Message\EntityEnclosingRequestInterface``

#### See

``Guzzle\Http\ClientInterface::createRequest()``
# `public `Guzzle\Http\Message\EntityEnclosingRequestInterface``
`post( string|array $uri = null, array|`Guzzle\Common\Collection` $headers = null, array|`Guzzle\Common\Collection`|string|`Guzzle\Http\EntityBodyInterface` $postBody = null, array $options = array() )`

Create a POST request for the client

#### Parameters

$uri
  `string|array`
  $uri Resource URI
$headers
  `array|`Guzzle\Common\Collection``
  $headers HTTP headers
$postBody
  `array|`Guzzle\Common\Collection`|string|`Guzzle\Http\EntityBodyInterface``
  $postBody 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 Options to apply to the request

#### Returns

``Guzzle\Http\Message\EntityEnclosingRequestInterface``

#### See

``Guzzle\Http\ClientInterface::createRequest()``
# `public `Guzzle\Http\Message\RequestInterface``
`options( string|array $uri = null, array $options = array() )`

Create an OPTIONS request for the client

#### Parameters

$uri
  `string|array`
  $uri Resource URI
$options
  `array`
  $options Options to apply to the request

#### Returns

``Guzzle\Http\Message\RequestInterface``

#### See

``Guzzle\Http\ClientInterface::createRequest()``
# `public `Guzzle\Http\Message\Response`|array`
`send( array|`Guzzle\Http\Message\RequestInterface` $requests )`

Sends a single request or an array of requests in parallel

#### Parameters

$requests
  `array|`Guzzle\Http\Message\RequestInterface``
  $requests One or more RequestInterface objects to send

#### Returns

``Guzzle\Http\Message\Response`|array`
Returns a single Response or an array of Response objects
# `public string|null`
`getBaseUrl( boolean $expand = true )`

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

#### Parameters

$expand
  `boolean`
  $expand Set to FALSE to get the raw base URL without URI template expansion

#### Returns

`string|null`
# `public `Guzzle\Http\ClientInterface``
`setBaseUrl( string $url )`

Set the base URL of the client

#### Parameters

$url
  `string`
  $url The base service endpoint URL of the webservice

#### Returns

``Guzzle\Http\ClientInterface``
# `public `Guzzle\Http\ClientInterface``
`setUserAgent( string $userAgent, boolean $includeDefault = false )`

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

#### Parameters

$userAgent
  `string`
  $userAgent User agent string
$includeDefault
  `boolean`
  $includeDefault Set to true to prepend the value to Guzzle's default user agent string

#### Returns

``Guzzle\Http\ClientInterface``
# `public `Guzzle\Http\ClientInterface``
`setSslVerification( string|boolean $certificateAuthority = true, boolean $verifyPeer = true, integer $verifyHost = 2 )`

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.

#### Parameters

$certificateAuthority
  `string|boolean`
  $certificateAuthority bool, file path, or directory path
$verifyPeer
  `boolean`
  $verifyPeer FALSE to stop from verifying the peer's certificate.
$verifyHost
  `integer`
  $verifyHost 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.

#### Returns

``Guzzle\Http\ClientInterface``

### Methods inherited from Guzzle\Common\HasDispatcherInterface

`addSubscriber()`, `dispatch()`, `getAllEvents()`, `getEventDispatcher()`, `setEventDispatcher()`

### Magic methods summary

## Constants summary

`string` | `CREATE_REQUEST` | `'client.create_request'` | #
`string` | `HTTP_DATE` | `'D, d M Y H:i:s \G\M\T'` | # RFC 1123 HTTP-Date