Config
in package
Tags
Table of Contents
- RELATIVE_PATHS = 1
- $defaultConfig : mixed
- $defaultRepositories : mixed
- $authConfigSource : ConfigSourceInterface
- $baseDir : mixed
- $config : mixed
- $configSource : ConfigSourceInterface
- $repositories : mixed
- $useEnvironment : mixed
- $warnedHosts : mixed
- __construct() : mixed
- all() : mixed
- disableProcessTimeout() : mixed
- Used by long-running custom scripts in composer.json
- get() : mixed
- Returns a setting
- getAuthConfigSource() : mixed
- getConfigSource() : mixed
- getRepositories() : array<string|int, mixed>
- has() : bool
- Checks whether a setting exists
- merge() : mixed
- Merges new config values with the existing ones (overriding)
- prohibitUrlByConfig() : mixed
- Validates that the passed URL is allowed to be used by current config, or throws an exception.
- raw() : mixed
- setAuthConfigSource() : mixed
- setConfigSource() : mixed
- disableRepoByName() : mixed
- getComposerEnv() : string|bool
- Reads the value of a Composer environment variable
- process() : string|int|null
- Replaces {$refs} inside a config string
- realpath() : string
- Turns relative paths in absolute paths without realpath()
Constants
RELATIVE_PATHS
public
mixed
RELATIVE_PATHS
= 1
Properties
$defaultConfig
public
static mixed
$defaultConfig
= array(
'process-timeout' => 300,
'use-include-path' => false,
'preferred-install' => 'auto',
'notify-on-install' => true,
'github-protocols' => array('https', 'ssh', 'git'),
'vendor-dir' => 'vendor',
'bin-dir' => '{$vendor-dir}/bin',
'cache-dir' => '{$home}/cache',
'data-dir' => '{$home}',
'cache-files-dir' => '{$cache-dir}/files',
'cache-repo-dir' => '{$cache-dir}/repo',
'cache-vcs-dir' => '{$cache-dir}/vcs',
'cache-ttl' => 15552000,
// 6 months
'cache-files-ttl' => null,
// fallback to cache-ttl
'cache-files-maxsize' => '300MiB',
'bin-compat' => 'auto',
'discard-changes' => false,
'autoloader-suffix' => null,
'sort-packages' => false,
'optimize-autoloader' => false,
'classmap-authoritative' => false,
'apcu-autoloader' => false,
'prepend-autoloader' => true,
'github-domains' => array('github.com'),
'bitbucket-expose-hostname' => true,
'disable-tls' => false,
'secure-http' => true,
'cafile' => null,
'capath' => null,
'github-expose-hostname' => true,
'gitlab-domains' => array('gitlab.com'),
'store-auths' => 'prompt',
'platform' => array(),
'archive-format' => 'tar',
'archive-dir' => '.',
'htaccess-protect' => true,
'use-github-api' => true,
'lock' => true,
)
$defaultRepositories
public
static mixed
$defaultRepositories
= array('packagist.org' => array('type' => 'composer', 'url' => 'https?://repo.packagist.org', 'allow_ssl_downgrade' => true))
$authConfigSource
private
ConfigSourceInterface
$authConfigSource
$baseDir
private
mixed
$baseDir
$config
private
mixed
$config
$configSource
private
ConfigSourceInterface
$configSource
$repositories
private
mixed
$repositories
$useEnvironment
private
mixed
$useEnvironment
$warnedHosts
private
mixed
$warnedHosts
= array()
Methods
__construct()
public
__construct([bool $useEnvironment = true ][, string $baseDir = null ]) : mixed
Parameters
- $useEnvironment : bool = true
-
Use COMPOSER_ environment variables to replace config settings
- $baseDir : string = null
-
Optional base directory of the config
Return values
mixed —all()
public
all(mixed $flags) : mixed
Parameters
- $flags : mixed
Return values
mixed —disableProcessTimeout()
Used by long-running custom scripts in composer.json
public
static disableProcessTimeout() : mixed
"scripts": { "watch": [ "Composer\Config::disableProcessTimeout", "vendor/bin/long-running-script --watch" ] }
Return values
mixed —get()
Returns a setting
public
get(string $key, int $flags) : mixed
Parameters
- $key : string
- $flags : int
-
Options (see class constants)
Tags
Return values
mixed —getAuthConfigSource()
public
getAuthConfigSource() : mixed
Return values
mixed —getConfigSource()
public
getConfigSource() : mixed
Return values
mixed —getRepositories()
public
getRepositories() : array<string|int, mixed>
Return values
array<string|int, mixed> —has()
Checks whether a setting exists
public
has(string $key) : bool
Parameters
- $key : string
Return values
bool —merge()
Merges new config values with the existing ones (overriding)
public
merge(array<string|int, mixed> $config) : mixed
Parameters
- $config : array<string|int, mixed>
Return values
mixed —prohibitUrlByConfig()
Validates that the passed URL is allowed to be used by current config, or throws an exception.
public
prohibitUrlByConfig(string $url[, IOInterface $io = null ]) : mixed
Parameters
- $url : string
- $io : IOInterface = null
Return values
mixed —raw()
public
raw() : mixed
Return values
mixed —setAuthConfigSource()
public
setAuthConfigSource(ConfigSourceInterface $source) : mixed
Parameters
- $source : ConfigSourceInterface
Return values
mixed —setConfigSource()
public
setConfigSource(ConfigSourceInterface $source) : mixed
Parameters
- $source : ConfigSourceInterface
Return values
mixed —disableRepoByName()
private
disableRepoByName(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —getComposerEnv()
Reads the value of a Composer environment variable
private
getComposerEnv(string $var) : string|bool
This should be used to read COMPOSER_ environment variables that overload config values.
Parameters
- $var : string
Return values
string|bool —process()
Replaces {$refs} inside a config string
private
process(string|int|null $value, int $flags) : string|int|null
Parameters
- $value : string|int|null
-
a config string that can contain {$refs-to-other-config}
- $flags : int
-
Options (see class constants)
Return values
string|int|null —realpath()
Turns relative paths in absolute paths without realpath()
private
realpath(string $path) : string
Since the dirs might not exist yet we can not call realpath or it will fail.
Parameters
- $path : string