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

# Class Client

Client object for executing commands on a web service.

  Guzzle\Common\AbstractHasDispatcher implements Guzzle\Common\HasDispatcherInterface
  Guzzle\Http\Client implements Guzzle\Http\ClientInterface
  Guzzle\Service\Client implements Guzzle\Service\ClientInterface

### Direct known subclasses

`Aws\Common\Client\AbstractClient`

### Indirect known subclasses

`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\DefaultClient`, `Aws\Common\InstanceMetadata\InstanceMetadataClient`, `Aws\ConfigService\ConfigServiceClient`, `Aws\DataPipeline\DataPipelineClient`, `Aws\CloudFront\CloudFrontClient`, `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\Efs\EfsClient`, `Aws\ElastiCache\ElastiCacheClient`, `Aws\CloudFront_2012_05_05\CloudFrontClient`, `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\Kinesis\KinesisClient`, `Aws\Kms\KmsClient`, `Aws\CloudHsm\CloudHsmClient`, `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\Ses\SesClient`, `Aws\SimpleDb\SimpleDbClient`, `Aws\CloudSearch\CloudSearchClient`, `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`, `Aws\CloudSearchDomain\CloudSearchDomainClient`, `Aws\CloudTrail\CloudTrailClient`, `Aws\CloudWatch\CloudWatchClient`

Namespace: Guzzle\Service
Located at Guzzle/Service/Client.php

## Methods summary

- `public static` `factory ( array|Collection $config = array() )`

  Basic factory method to create a new client. Extend this method in subclasses to build more complex clients.

- `public static` `getAllEvents ( )`

  Get a list of all of the events emitted from the class

- `public` `__call ( string $method, array $args )`

  Magic method used to retrieve a command

- `public` `getCommand ( string $name, array $args = array() )`

  Get a command by name. First, the client will see if it has a service description and if the service description defines a command by the supplied name. If no dynamic command is found, the client will look for a concrete command class exists matching the name supplied. If neither are found, an InvalidArgumentException is thrown.

- `public` `setCommandFactory ( Guzzle\Service\Command\Factory\FactoryInterface $factory )`

  Set the command factory used to create commands by name

- `public` `setResourceIteratorFactory ( Guzzle\Service\Resource\ResourceIteratorFactoryInterface $factory )`

  Set the resource iterator factory associated with the client

- `public` `getIterator ( string|CommandInterface $command, array $commandOptions = null, array $iteratorOptions = array() )`

  Get a resource iterator from the client.

- `public` `execute ( CommandInterface|array|Traversable $command )`

  Execute one or more commands

- `public` `setDescription ( Guzzle\Service\Description\ServiceDescriptionInterface $service )`

  Set the service description of the client

- `public` `getDescription ( )`

  Get the service description of the client

- `public` `setInflector ( Guzzle\Inflection\InflectorInterface $inflector )`

  Set the inflector used with the client

- `public` `getInflector ( )`

  Get the inflector used with the client

- `protected` `prepareCommand ( Guzzle\Service\Command\CommandInterface $command )`

  Prepare a command for sending and get the RequestInterface object created by the command

- `protected` `executeMultiple ( array|Traversable $commands )`

  Execute multiple commands in parallel

- `protected` `getResourceIteratorFactory ( )`
- `protected` `getCommandFactory ( )`

  Get the command factory associated with the client

## Methods detail

# `public static `Guzzle\Service\Client``
`factory( array|`Guzzle\Common\Collection` $config = array() )`

Basic factory method to create a new client. Extend this method in subclasses to build more complex clients.

#### Parameters

$config
  `array|`Guzzle\Common\Collection``
  $config Configuration data

#### Returns

``Guzzle\Service\Client``

#### Implementation of

`Guzzle\Common\FromConfigInterface::factory()`
# `public static array`
`getAllEvents( )`

Get a list of all of the events emitted from the class

#### Returns

`array`

#### Overrides

`Guzzle\Http\Client::getAllEvents`

#### Implementation of

`Guzzle\Common\HasDispatcherInterface::getAllEvents()`
# `public mixed`
`__call( string $method, array $args )`

Magic method used to retrieve a command

#### Parameters

$method
  `string`
  $method Name of the command object to instantiate
$args
  `array`
  $args Arguments to pass to the command

#### Returns

`mixed`
Returns the result of the command

#### Throws

``Guzzle\Common\Exception\BadMethodCallException``
when a command is not found
# `public `Guzzle\Service\Command\CommandInterface``
`getCommand( string $name, array $args = array() )`

Get a command by name. First, the client will see if it has a service description and if the service description defines a command by the supplied name. If no dynamic command is found, the client will look for a concrete command class exists matching the name supplied. If neither are found, an InvalidArgumentException is thrown.

#### Parameters

$name
  `string`
  $name Name of the command to retrieve
$args
  `array`
  $args Arguments to pass to the command

#### Returns

``Guzzle\Service\Command\CommandInterface``

#### Throws

``Guzzle\Common\Exception\InvalidArgumentException``
if no command can be found by name

#### Implementation of

`Guzzle\Service\ClientInterface::getCommand()`
# `public `Guzzle\Service\Client``
`setCommandFactory( `Guzzle\Service\Command\Factory\FactoryInterface` $factory )`

Set the command factory used to create commands by name

#### Parameters

$factory
  ``Guzzle\Service\Command\Factory\FactoryInterface``
  $factory Command factory

#### Returns

``Guzzle\Service\Client``
# `public `Guzzle\Service\Client``
`setResourceIteratorFactory( `Guzzle\Service\Resource\ResourceIteratorFactoryInterface` $factory )`

Set the resource iterator factory associated with the client

#### Parameters

$factory
  ``Guzzle\Service\Resource\ResourceIteratorFactoryInterface``
  $factory Resource iterator factory

#### Returns

``Guzzle\Service\Client``
# `public ResourceIteratorInterface`
`getIterator( string|`Guzzle\Service\Command\CommandInterface` $command, array $commandOptions = null, array $iteratorOptions = array() )`

Get a resource iterator from the client.

#### Parameters

$command
  `string|`Guzzle\Service\Command\CommandInterface``
  $command Command class or command name.
$commandOptions
  `array`
  $commandOptions Command options used when creating commands.
$iteratorOptions
  `array`
  $iteratorOptions Iterator options passed to the iterator when it is instantiated.

#### Returns

`ResourceIteratorInterface`

#### Implementation of

`Guzzle\Service\ClientInterface::getIterator()`
# `public mixed`
`execute( `Guzzle\Service\Command\CommandInterface`|array|`Traversable` $command )`

Execute one or more commands

#### Parameters

$command
  ``Guzzle\Service\Command\CommandInterface`|array|`Traversable``
  $command Command, array of commands or Traversable object containing commands to execute

#### Returns

`mixed`
Returns the result of the executed command or an array of commands if executing multiple commands

#### Throws

``Guzzle\Common\Exception\InvalidArgumentException``
if an invalid command is passed
``Guzzle\Service\Exception\CommandTransferException``
if an exception is encountered when transferring multiple commands

#### Implementation of

`Guzzle\Service\ClientInterface::execute()`
# `public `Guzzle\Service\ClientInterface``
`setDescription( `Guzzle\Service\Description\ServiceDescriptionInterface` $service )`

Set the service description of the client

#### Parameters

$service
  ``Guzzle\Service\Description\ServiceDescriptionInterface``
  $service Service description

#### Returns

``Guzzle\Service\ClientInterface``

#### Implementation of

`Guzzle\Service\ClientInterface::setDescription()`
# `public `Guzzle\Service\Description\ServiceDescriptionInterface`|null`
`getDescription( )`

Get the service description of the client

#### Returns

``Guzzle\Service\Description\ServiceDescriptionInterface`|null`

#### Implementation of

`Guzzle\Service\ClientInterface::getDescription()`
# `public `Guzzle\Service\Client``
`setInflector( `Guzzle\Inflection\InflectorInterface` $inflector )`

Set the inflector used with the client

#### Parameters

$inflector
  ``Guzzle\Inflection\InflectorInterface``
  $inflector Inflection object

#### Returns

``Guzzle\Service\Client``
# `public `Guzzle\Service\Client``
`getInflector( )`

Get the inflector used with the client

#### Returns

``Guzzle\Service\Client``
# `protected `Guzzle\Http\Message\RequestInterface``
`prepareCommand( `Guzzle\Service\Command\CommandInterface` $command )`

Prepare a command for sending and get the RequestInterface object created by the command

#### Parameters

$command
  ``Guzzle\Service\Command\CommandInterface``
  $command Command to prepare

#### Returns

``Guzzle\Http\Message\RequestInterface``
# `protected array`
`executeMultiple( array|`Traversable` $commands )`

Execute multiple commands in parallel

#### Parameters

$commands
  `array|`Traversable``
  $commands Array of CommandInterface objects to execute

#### Returns

`array`
Returns an array of the executed commands

#### Throws

``Guzzle\Service\Exception\CommandTransferException``
# `protected`
`getResourceIteratorFactory( )`
# `protected `Guzzle\Service\Command\Factory\FactoryInterface``
`getCommandFactory( )`

Get the command factory associated with the client

#### Returns

``Guzzle\Service\Command\Factory\FactoryInterface``

### Methods inherited from Guzzle\Http\Client

`__construct()`, `createRequest()`, `delete()`, `expandTemplate()`, `extractPharCacert()`, `get()`, `getBaseUrl()`, `getConfig()`, `getCurlMulti()`, `getDefaultOption()`, `getDefaultUserAgent()`, `getUriTemplate()`, `head()`, `initSsl()`, `options()`, `patch()`, `post()`, `prepareRequest()`, `put()`, `send()`, `sendMultiple()`, `setBaseUrl()`, `setConfig()`, `setCurlMulti()`, `setDefaultOption()`, `setRequestFactory()`, `setSslVerification()`, `setUriTemplate()`, `setUserAgent()`

### Methods inherited from Guzzle\Common\AbstractHasDispatcher

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

### Magic methods summary

## Constants summary

`string` | `COMMAND_PARAMS` | `'command.params'` | #

### Constants inherited from Guzzle\Http\Client

`CURL_OPTIONS`, `DEFAULT_SELECT_TIMEOUT`, `DISABLE_REDIRECTS`, `MAX_HANDLES`, `REQUEST_OPTIONS`, `SSL_CERT_AUTHORITY`

### Constants inherited from Guzzle\Http\ClientInterface

`CREATE_REQUEST`, `HTTP_DATE`

## Properties summary

`protected `Guzzle\Service\Description\ServiceDescriptionInterface`` | $serviceDescription | # Description of the service and possible commands
`protected `Guzzle\Service\Command\Factory\FactoryInterface`` | $commandFactory | #
`protected `Guzzle\Service\Resource\ResourceIteratorFactoryInterface`` | $resourceIteratorFactory | #
`protected `Guzzle\Inflection\InflectorInterface`` | $inflector | # Inflector associated with the service/client

### Properties inherited from Guzzle\Http\Client

`$defaultHeaders`, `$requestFactory`, `$userAgent`

### Properties inherited from Guzzle\Common\AbstractHasDispatcher

`$eventDispatcher`