Aws\Sdk::createClient PHP Method

createClient() public method

Get a client by name using an array of constructor options.
See also: Aws\AwsClient::__construct for a list of available options for args.
public createClient ( string $name, array $args = [] ) : aws\AwsClientInterface
$name string Service name or namespace (e.g., DynamoDb, s3).
$args array Arguments to configure the client.
return aws\AwsClientInterface
    public function createClient($name, array $args = [])
    {
        // Get information about the service from the manifest file.
        $service = manifest($name);
        $namespace = $service['namespace'];
        // Instantiate the client class.
        $client = "Aws\\{$namespace}\\{$namespace}Client";
        return new $client($this->mergeArgs($namespace, $service, $args));
    }

Usage Example

Beispiel #1
0
 /**
  * @param AWSCredentials $AWSCredentials
  * @param $service
  *
  * @throws \InvalidArgumentException
  *
  * @return mixed
  */
 public function get(AWSCredentials $AWSCredentials, $service)
 {
     $aws = new Aws($AWSCredentials->getParameters());
     return $aws->createClient($service, $AWSCredentials->getParameters($service));
 }
All Usage Examples Of Aws\Sdk::createClient