SDK for PHP 3.x

ConfigurationResolver
in package

Table of Contents

Constants

ENV_CONFIG_FILE  = 'AWS_CONFIG_FILE'
ENV_PROFILE  = 'AWS_PROFILE'

Properties

$envPrefix  : mixed

Methods

env()  : null
Resolves config values from environment variables.
ini()  : null
Gets config values from a config file whose location is specified by an environment variable 'AWS_CONFIG_FILE', defaulting to ~/.aws/config if not specified
resolve()  : mixed
Generic configuration resolver that first checks for environment variables, then checks for a specified profile in the environment-defined config file location (env variable is 'AWS_CONFIG_FILE', file location defaults to ~/.aws/config), then checks for the "default" profile in the environment-defined config file location, and failing those uses a default fallback value.

Constants

ENV_CONFIG_FILE

public mixed ENV_CONFIG_FILE = 'AWS_CONFIG_FILE'

ENV_PROFILE

public mixed ENV_PROFILE = 'AWS_PROFILE'

Properties

$envPrefix

public static mixed $envPrefix = 'AWS_'

Methods

env()

Resolves config values from environment variables.

public static env(string $key, string $expectedType) : null
Parameters
$key : string

Configuration key to be used when attempting to retrieve value from the environment.

$expectedType : string

The expected type of the retrieved value.

Return values
null

| mixed

ini()

Gets config values from a config file whose location is specified by an environment variable 'AWS_CONFIG_FILE', defaulting to ~/.aws/config if not specified

public static ini(string $key, string $expectedType[, string|null $profile = null ][, string|null $filename = null ][, mixed $options = [] ]) : null
Parameters
$key : string

Configuration key to be used when attempting to retrieve value from ini file.

$expectedType : string

The expected type of the retrieved value.

$profile : string|null = null

Profile to use. If not specified will use the "default" profile.

$filename : string|null = null

If provided, uses a custom filename rather than looking in the default directory.

$options : mixed = []
Return values
null

| mixed

resolve()

Generic configuration resolver that first checks for environment variables, then checks for a specified profile in the environment-defined config file location (env variable is 'AWS_CONFIG_FILE', file location defaults to ~/.aws/config), then checks for the "default" profile in the environment-defined config file location, and failing those uses a default fallback value.

public static resolve(string $key, mixed $defaultValue, string $expectedType[, array<string|int, mixed> $config = [] ]) : mixed
Parameters
$key : string

Configuration key to be used when attempting to retrieve value from the environment or ini file.

$defaultValue : mixed
$expectedType : string

The expected type of the retrieved value.

$config : array<string|int, mixed> = []

additional configuration options.

On this page