Aws
extends ServiceBuilder
in package
Base class for interacting with web service clients
Table of Contents
Constants
- VERSION = '2.8.28'
Properties
- $builderConfig : array<string|int, mixed>
- $cachedFactory : ServiceBuilderLoader
- $clients : array<string|int, mixed>
- $eventDispatcher : EventDispatcherInterface
- $plugins : array<string|int, mixed>
Methods
- __construct() : mixed
- __serialize() : mixed
- to fix php 8.1 compatibility
- __unserialize() : mixed
- to fix php 8.1 compatibility
- addGlobalPlugin() : self
- Attach a plugin to every client created by the builder
- addSubscriber() : self
- Add an event subscriber to the dispatcher
- dispatch() : Event
- Helper to dispatch Guzzle events and set the event name on the event
- enableFacades() : Aws
- Enables the facades for the clients defined in the service builder
- factory() : Aws
- Create a new service locator for the AWS SDK
- get() : ClientInterface|mixed
- Get a ClientInterface object or arbitrary data from the service builder
- getAllEvents() : array<string|int, mixed>
- Get a list of all of the events emitted from the class
- getConfig() : array<string|int, mixed>
- Returns the configuration for the service builder
- getData() : array<string|int, mixed>|null
- Get data from the service builder without triggering the building of a service
- getDefaultServiceDefinition() : string
- Get the full path to the default service builder definition file
- getEventDispatcher() : EventDispatcherInterface
- Get the EventDispatcher of the request
- offsetExists() : mixed
- offsetGet() : mixed
- offsetSet() : mixed
- offsetUnset() : mixed
- serialize() : mixed
- set() : ServiceBuilderInterface
- Register a service or arbitrary data by name with the service builder
- setEventDispatcher() : self
- Set the EventDispatcher of the request
- unserialize() : mixed
Constants
VERSION
public
string
VERSION
= '2.8.28'
Current version of the SDK
Properties
$builderConfig
protected
array<string|int, mixed>
$builderConfig
= array()
Service builder configuration data
$cachedFactory
protected
static ServiceBuilderLoader
$cachedFactory
Cached instance of the service builder loader
$clients
protected
array<string|int, mixed>
$clients
= array()
Instantiated client objects
$eventDispatcher
protected
EventDispatcherInterface
$eventDispatcher
$plugins
protected
array<string|int, mixed>
$plugins
= array()
Plugins to attach to each client created by the service builder
Methods
__construct()
public
__construct([array<string|int, mixed> $serviceBuilderConfig = array() ]) : mixed
Parameters
- $serviceBuilderConfig : array<string|int, mixed> = array()
-
Service configuration settings:
- name: Name of the service
- class: Client class to instantiate using a factory method
- params: array of key value pair configuration settings for the builder
__serialize()
to fix php 8.1 compatibility
public
__serialize() : mixed
__unserialize()
to fix php 8.1 compatibility
public
__unserialize(mixed $serialized) : mixed
Parameters
- $serialized : mixed
addGlobalPlugin()
Attach a plugin to every client created by the builder
public
addGlobalPlugin(EventSubscriberInterface $plugin) : self
Parameters
- $plugin : EventSubscriberInterface
-
Plugin to attach to each client
Return values
selfaddSubscriber()
Add an event subscriber to the dispatcher
public
addSubscriber(EventSubscriberInterface $subscriber) : self
Parameters
- $subscriber : EventSubscriberInterface
-
Event subscriber
Return values
selfdispatch()
Helper to dispatch Guzzle events and set the event name on the event
public
dispatch(mixed $eventName[, array<string|int, mixed> $context = array() ]) : Event
Parameters
- $eventName : mixed
-
Name of the event to dispatch
- $context : array<string|int, mixed> = array()
-
Context of the event
Return values
Event —Returns the created event object
enableFacades()
Enables the facades for the clients defined in the service builder
public
enableFacades([string|null $namespace = null ]) : Aws
"Facades" are being removed in version 3.0 of the SDK.
Parameters
- $namespace : string|null = null
-
The namespace that the facades should be mounted to. Defaults to global namespace
Return values
Awsfactory()
Create a new service locator for the AWS SDK
public
static factory([array<string|int, mixed>|string $config = null ][, array<string|int, mixed> $globalParameters = array() ]) : Aws
You can configure the service locator is four different ways:
-
Use the default configuration file shipped with the SDK that wires class names with service short names and specify global parameters to add to every definition (e.g. key, secret, credentials, etc)
-
Use a custom configuration file that extends the default config and supplies credentials for each service.
-
Use a custom config file that wires services to custom short names for services.
-
If you are on Amazon EC2, you can use the default configuration file and not provide any credentials so that you are using InstanceProfile credentials.
Parameters
- $config : array<string|int, mixed>|string = null
-
The full path to a .php or .js|.json file, or an associative array of data to use as global parameters to pass to each service.
- $globalParameters : array<string|int, mixed> = array()
-
Global parameters to pass to every service as it is instantiated.
Return values
Awsget()
Get a ClientInterface object or arbitrary data from the service builder
public
get(mixed $name[, mixed $throwAway = false ]) : ClientInterface|mixed
Parameters
- $name : mixed
-
Name of the registered service or data to retrieve
- $throwAway : mixed = false
-
Only pertains to retrieving client objects built using a configuration array. Set to TRUE to not store the client for later retrieval from the ServiceBuilder. If an array is specified, that data will overwrite the configured params of the client if the client implements FromConfigInterface and will not store the client for later retrieval.
Return values
ClientInterface|mixedgetAllEvents()
Get a list of all of the events emitted from the class
public
static getAllEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>getConfig()
Returns the configuration for the service builder
public
getConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>getData()
Get data from the service builder without triggering the building of a service
public
getData(string $name) : array<string|int, mixed>|null
Parameters
- $name : string
-
Name of the service to retrieve
Return values
array<string|int, mixed>|nullgetDefaultServiceDefinition()
Get the full path to the default service builder definition file
public
static getDefaultServiceDefinition() : string
Return values
stringgetEventDispatcher()
Get the EventDispatcher of the request
public
getEventDispatcher() : EventDispatcherInterface
Return values
EventDispatcherInterfaceoffsetExists()
public
offsetExists(mixed $offset) : mixed
Parameters
- $offset : mixed
Attributes
- #[ReturnTypeWillChange]
offsetGet()
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Attributes
- #[ReturnTypeWillChange]
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : mixed
Parameters
- $offset : mixed
- $value : mixed
Attributes
- #[ReturnTypeWillChange]
offsetUnset()
public
offsetUnset(mixed $offset) : mixed
Parameters
- $offset : mixed
Attributes
- #[ReturnTypeWillChange]
serialize()
public
serialize() : mixed
set()
Register a service or arbitrary data by name with the service builder
public
set(mixed $key, mixed $service) : ServiceBuilderInterface
Parameters
- $key : mixed
-
Name of the client or data to register
- $service : mixed
-
Client configuration array or arbitrary data to register. The client configuration array must include a 'class' (string) and 'params' (array) key.
Return values
ServiceBuilderInterfacesetEventDispatcher()
Set the EventDispatcher of the request
public
setEventDispatcher(EventDispatcherInterface $eventDispatcher) : self
Parameters
- $eventDispatcher : EventDispatcherInterface
Return values
selfunserialize()
public
unserialize(mixed $serialized) : mixed
Parameters
- $serialized : mixed