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

Installer setWhitelistDependencies(bool $updateDependencies = true)

Should 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 153
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 172
public int run()

Run installation (or update)

Return Value

int 0 on success or a positive error code on failure

Exceptions

Exception

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

Create Installer

Parameters

IOInterface $io
Composer $composer

Return Value

Installer

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

Parameters

RepositoryInterface $additionalInstalledRepository

Return Value

$this

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

Whether to run in drymode or not

Parameters

bool $dryRun

Return Value

Installer

at line 1455
public bool isDryRun()

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

Return Value

bool

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

prefer source installation

Parameters

bool $preferSource

Return Value

Installer

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

prefer dist installation

Parameters

bool $preferDist

Return Value

Installer

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

Whether or not generated autoloader are optimized

Parameters

bool $optimizeAutoloader

Return Value

Installer

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

Whether or not generated autoloader considers the class map authoritative.

Parameters

bool $classMapAuthoritative

Return Value

Installer

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

Whether or not generated autoloader considers APCu caching.

Parameters

bool $apcuAutoloader

Return Value

Installer

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

update packages

Parameters

bool $update

Return Value

Installer

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

enables dev packages

Parameters

bool $devMode

Return Value

Installer

at line 1569
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 1584
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 1597
public Installer setConfig(Config $config)

set the config instance

Parameters

Config $config

Return Value

Installer

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

run in verbose mode

Parameters

bool $verbose

Return Value

Installer

at line 1622
public bool isVerbose()

Checks, if running in verbose mode.

Return Value

bool

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

set ignore Platform Package requirements

Parameters

bool $ignorePlatformReqs

Return Value

Installer

at line 1647
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 Installer setWhitelistDependencies(bool $updateDependencies = true)

Should dependencies of whitelisted packages be updated recursively?

Parameters

bool $updateDependencies

Return Value

Installer

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

Should packages be preferred in a stable version when updating?

Parameters

bool $preferStable

Return Value

Installer

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

Should packages be preferred in a lowest version when updating?

Parameters

bool $preferLowest

Return Value

Installer

at line 1701
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 1716
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 1729
public Installer setSkipSuggest(bool $skipSuggest = true)

Should suggestions be skipped?

Parameters

bool $skipSuggest

Return Value

Installer

at line 1745
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 1756
public Installer setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)

Parameters

SuggestedPackagesReporter $suggestedPackagesReporter

Return Value

Installer