Composer API
Class

Composer\Config

class Config

Constants

RELATIVE_PATHS

Properties

static $defaultConfig
static $defaultRepositories

Methods

__construct(bool $useEnvironment = true, string $baseDir = null)

setConfigSource(ConfigSourceInterface $source)

getConfigSource()

setAuthConfigSource(ConfigSourceInterface $source)

getAuthConfigSource()

merge(array $config)

Merges new config values with the existing ones (overriding)

array getRepositories()

mixed get(string $key, int $flags)

Returns a setting

all($flags)

raw()

bool has(string $key)

Checks whether a setting exists

prohibitUrlByConfig(string $url, IOInterface $io = null)

Validates that the passed URL is allowed to be used by current config, or throws an exception.

Details

at line 94
public __construct(bool $useEnvironment = true, string $baseDir = null)

Parameters

bool $useEnvironment Use COMPOSER_ environment variables to replace config settings
string $baseDir Optional base directory of the config

at line 103
public setConfigSource(ConfigSourceInterface $source)

Parameters

ConfigSourceInterface $source

at line 108
public getConfigSource()

at line 113
public setAuthConfigSource(ConfigSourceInterface $source)

Parameters

ConfigSourceInterface $source

at line 118
public getAuthConfigSource()

at line 128
public merge(array $config)

Merges new config values with the existing ones (overriding)

Parameters

array $config

at line 193
public array getRepositories()

Return Value

array

at line 206
public mixed get(string $key, int $flags)

Returns a setting

Parameters

string $key
int $flags Options (see class constants)

Return Value

mixed

Exceptions

RuntimeException

at line 331
public all($flags)

Parameters

$flags

at line 343
public raw()

at line 357
public bool has(string $key)

Checks whether a setting exists

Parameters

string $key

Return Value

bool

at line 432
public prohibitUrlByConfig(string $url, IOInterface $io = null)

Validates that the passed URL is allowed to be used by current config, or throws an exception.

Parameters

string $url
IOInterface $io