Composer API
Class

Composer\Installer

class Installer

Methods

__construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)

Constructor

int run()

Run installation (or update)

static Installer create(IOInterface $io, Composer $composer)

Create Installer

$this setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)

Installer setDryRun(bool $dryRun = true)

Whether to run in drymode or not

bool isDryRun()

Checks, if this is a dry run (simulation mode).

Installer setPreferSource(bool $preferSource = true)

prefer source installation

Installer setPreferDist(bool $preferDist = true)

prefer dist installation

Installer setOptimizeAutoloader(bool $optimizeAutoloader = false)

Whether or not generated autoloader are optimized

Installer setClassMapAuthoritative(bool $classMapAuthoritative = false)

Whether or not generated autoloader considers the class map authoritative.

Installer setApcuAutoloader(bool $apcuAutoloader = false)

Whether or not generated autoloader considers APCu caching.

Installer setUpdate(bool $update = true)

update packages

Installer setDevMode(bool $devMode = true)

enables dev packages

Installer setDumpAutoloader(bool $dumpAutoloader = true)

set whether to run autoloader or not

Installer setRunScripts(bool $runScripts = true)

set whether to run scripts or not

Installer setConfig(Config $config)

set the config instance

Installer setVerbose(bool $verbose = true)

run in verbose mode

bool isVerbose()

Checks, if running in verbose mode.

Installer setIgnorePlatformRequirements(bool $ignorePlatformReqs = false)

set ignore Platform Package requirements

Installer setUpdateWhitelist(array $packages)

restrict the update operation to a few packages, all other packages that are already installed will be kept at their current version

setWhitelistDependencies($updateDependencies = true)

Installer setWhitelistTransitiveDependencies(bool $updateTransitiveDependencies = true)

Should dependencies of whitelisted packages (but not direct dependencies) be updated?

Installer setWhitelistAllDependencies(bool $updateAllDependencies = true)

Should all dependencies of whitelisted packages be updated recursively?

Installer setPreferStable(bool $preferStable = true)

Should packages be preferred in a stable version when updating?

Installer setPreferLowest(bool $preferLowest = true)

Should packages be preferred in a lowest version when updating?

Installer setWriteLock(bool $writeLock = true)

Should the lock file be updated when updating?

Installer setExecuteOperations(bool $executeOperations = true)

Should the operations (packge install, update and removal) be executed on disk?

Installer setSkipSuggest(bool $skipSuggest = true)

Should suggestions be skipped?

Installer disablePlugins()

Disables plugins.

Installer setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)

Details

at line 154
public __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)

Constructor

Parameters

IOInterface $io
Config $config
RootPackageInterface $package
DownloadManager $downloadManager
RepositoryManager $repositoryManager
Locker $locker
InstallationManager $installationManager
EventDispatcher $eventDispatcher
AutoloadGenerator $autoloadGenerator

at line 173
public int run()

Run installation (or update)

Return Value

int 0 on success or a positive error code on failure

Exceptions

Exception

at line 1414
static public Installer create(IOInterface $io, Composer $composer)

Create Installer

Parameters

IOInterface $io
Composer $composer

Return Value

Installer

at line 1433
public $this setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)

Parameters

RepositoryInterface $additionalInstalledRepository

Return Value

$this

at line 1446
public Installer setDryRun(bool $dryRun = true)

Whether to run in drymode or not

Parameters

bool $dryRun

Return Value

Installer

at line 1458
public bool isDryRun()

Checks, if this is a dry run (simulation mode).

Return Value

bool

at line 1469
public Installer setPreferSource(bool $preferSource = true)

prefer source installation

Parameters

bool $preferSource

Return Value

Installer

at line 1482
public Installer setPreferDist(bool $preferDist = true)

prefer dist installation

Parameters

bool $preferDist

Return Value

Installer

at line 1495
public Installer setOptimizeAutoloader(bool $optimizeAutoloader = false)

Whether or not generated autoloader are optimized

Parameters

bool $optimizeAutoloader

Return Value

Installer

at line 1514
public Installer setClassMapAuthoritative(bool $classMapAuthoritative = false)

Whether or not generated autoloader considers the class map authoritative.

Parameters

bool $classMapAuthoritative

Return Value

Installer

at line 1531
public Installer setApcuAutoloader(bool $apcuAutoloader = false)

Whether or not generated autoloader considers APCu caching.

Parameters

bool $apcuAutoloader

Return Value

Installer

at line 1544
public Installer setUpdate(bool $update = true)

update packages

Parameters

bool $update

Return Value

Installer

at line 1557
public Installer setDevMode(bool $devMode = true)

enables dev packages

Parameters

bool $devMode

Return Value

Installer

at line 1572
public Installer setDumpAutoloader(bool $dumpAutoloader = true)

set whether to run autoloader or not

This is disabled implicitly when enabling dryRun

Parameters

bool $dumpAutoloader

Return Value

Installer

at line 1587
public Installer setRunScripts(bool $runScripts = true)

set whether to run scripts or not

This is disabled implicitly when enabling dryRun

Parameters

bool $runScripts

Return Value

Installer

at line 1600
public Installer setConfig(Config $config)

set the config instance

Parameters

Config $config

Return Value

Installer

at line 1613
public Installer setVerbose(bool $verbose = true)

run in verbose mode

Parameters

bool $verbose

Return Value

Installer

at line 1625
public bool isVerbose()

Checks, if running in verbose mode.

Return Value

bool

at line 1636
public Installer setIgnorePlatformRequirements(bool $ignorePlatformReqs = false)

set ignore Platform Package requirements

Parameters

bool $ignorePlatformReqs

Return Value

Installer

at line 1650
public Installer setUpdateWhitelist(array $packages)

restrict the update operation to a few packages, all other packages that are already installed will be kept at their current version

Parameters

array $packages

Return Value

Installer

at line 1660
public setWhitelistDependencies($updateDependencies = true)

Parameters

$updateDependencies

at line 1674
public Installer setWhitelistTransitiveDependencies(bool $updateTransitiveDependencies = true)

Should dependencies of whitelisted packages (but not direct dependencies) be updated?

This will NOT whitelist any dependencies that are also directly defined in the root package.

Parameters

bool $updateTransitiveDependencies

Return Value

Installer

at line 1690
public Installer setWhitelistAllDependencies(bool $updateAllDependencies = true)

Should all dependencies of whitelisted packages be updated recursively?

This will whitelist any dependencies of the whitelisted packages, including those defined in the root package.

Parameters

bool $updateAllDependencies

Return Value

Installer

at line 1703
public Installer setPreferStable(bool $preferStable = true)

Should packages be preferred in a stable version when updating?

Parameters

bool $preferStable

Return Value

Installer

at line 1716
public Installer setPreferLowest(bool $preferLowest = true)

Should packages be preferred in a lowest version when updating?

Parameters

bool $preferLowest

Return Value

Installer

at line 1731
public Installer setWriteLock(bool $writeLock = true)

Should the lock file be updated when updating?

This is disabled implicitly when enabling dryRun

Parameters

bool $writeLock

Return Value

Installer

at line 1746
public Installer setExecuteOperations(bool $executeOperations = true)

Should the operations (packge install, update and removal) be executed on disk?

This is disabled implicitly when enabling dryRun

Parameters

bool $executeOperations

Return Value

Installer

at line 1759
public Installer setSkipSuggest(bool $skipSuggest = true)

Should suggestions be skipped?

Parameters

bool $skipSuggest

Return Value

Installer

at line 1775
public Installer disablePlugins()

Disables plugins.

Call this if you want to ensure that third-party code never gets executed. The default is to automatically install, and execute custom third-party installers.

Return Value

Installer

at line 1786
public Installer setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)

Parameters

SuggestedPackagesReporter $suggestedPackagesReporter

Return Value

Installer