class Installer (View source)

Properties

protected IOInterface $io
protected Config $config
protected RootPackageInterface $package
protected DownloadManager $downloadManager
protected RepositoryManager $repositoryManager
protected Locker $locker
protected InstallationManager $installationManager
protected EventDispatcher $eventDispatcher
protected AutoloadGenerator $autoloadGenerator
protected $preferSource
protected $preferDist
protected $optimizeAutoloader
protected $classMapAuthoritative
protected $apcuAutoloader
protected $devMode
protected $dryRun
protected $verbose
protected $update
protected $dumpAutoloader
protected $runScripts
protected $ignorePlatformReqs
protected $preferStable
protected $preferLowest
protected $skipSuggest
protected $writeLock
protected $executeOperations
protected array|null $updateWhitelist Array of package names/globs flagged for update
protected $whitelistDependencies
protected $whitelistAllDependencies
protected SuggestedPackagesReporter $suggestedPackagesReporter
protected RepositoryInterface $additionalInstalledRepository

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)

array
doInstall(RepositoryInterface $localRepo, RepositoryInterface $installedRepo, PlatformRepository $platformRepo, array $aliases)

No description

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

Create Installer

$this
setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)

No description

setDryRun(bool $dryRun = true)

Whether to run in drymode or not

bool
isDryRun()

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

setPreferSource(bool $preferSource = true)

prefer source installation

setPreferDist(bool $preferDist = true)

prefer dist installation

setOptimizeAutoloader(bool $optimizeAutoloader = false)

Whether or not generated autoloader are optimized

setClassMapAuthoritative(bool $classMapAuthoritative = false)

Whether or not generated autoloader considers the class map authoritative.

setApcuAutoloader(bool $apcuAutoloader = false)

Whether or not generated autoloader considers APCu caching.

setUpdate(bool $update = true)

update packages

setDevMode(bool $devMode = true)

enables dev packages

setDumpAutoloader(bool $dumpAutoloader = true)

set whether to run autoloader or not

setRunScripts(bool $runScripts = true)

set whether to run scripts or not

setConfig(Config $config)

set the config instance

setVerbose(bool $verbose = true)

run in verbose mode

bool
isVerbose()

Checks, if running in verbose mode.

setIgnorePlatformRequirements(bool $ignorePlatformReqs = false)

set ignore Platform Package requirements

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) deprecated

No description

setWhitelistTransitiveDependencies(bool $updateTransitiveDependencies = true)

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

setWhitelistAllDependencies(bool $updateAllDependencies = true)

Should all dependencies of whitelisted packages be updated recursively?

setPreferStable(bool $preferStable = true)

Should packages be preferred in a stable version when updating?

setPreferLowest(bool $preferLowest = true)

Should packages be preferred in a lowest version when updating?

setWriteLock(bool $writeLock = true)

Should the lock file be updated when updating?

setExecuteOperations(bool $executeOperations = true)

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

setSkipSuggest(bool $skipSuggest = true)

Should suggestions be skipped?

disablePlugins()

Disables plugins.

setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)

No description

Details

__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

int run()

Run installation (or update)

Return Value

int 0 on success or a positive error code on failure

Exceptions

Exception

protected array doInstall(RepositoryInterface $localRepo, RepositoryInterface $installedRepo, PlatformRepository $platformRepo, array $aliases)

Parameters

RepositoryInterface $localRepo
RepositoryInterface $installedRepo
PlatformRepository $platformRepo
array $aliases

Return Value

array [int, PackageInterfaces[]|null] with the exit code and an array of dev packages on update, or null on install

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

Create Installer

Parameters

IOInterface $io
Composer $composer

Return Value

Installer

$this setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)

Parameters

RepositoryInterface $additionalInstalledRepository

Return Value

$this

Installer setDryRun(bool $dryRun = true)

Whether to run in drymode or not

Parameters

bool $dryRun

Return Value

Installer

bool isDryRun()

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

Return Value

bool

Installer setPreferSource(bool $preferSource = true)

prefer source installation

Parameters

bool $preferSource

Return Value

Installer

Installer setPreferDist(bool $preferDist = true)

prefer dist installation

Parameters

bool $preferDist

Return Value

Installer

Installer setOptimizeAutoloader(bool $optimizeAutoloader = false)

Whether or not generated autoloader are optimized

Parameters

bool $optimizeAutoloader

Return Value

Installer

Installer setClassMapAuthoritative(bool $classMapAuthoritative = false)

Whether or not generated autoloader considers the class map authoritative.

Parameters

bool $classMapAuthoritative

Return Value

Installer

Installer setApcuAutoloader(bool $apcuAutoloader = false)

Whether or not generated autoloader considers APCu caching.

Parameters

bool $apcuAutoloader

Return Value

Installer

Installer setUpdate(bool $update = true)

update packages

Parameters

bool $update

Return Value

Installer

Installer setDevMode(bool $devMode = true)

enables dev packages

Parameters

bool $devMode

Return Value

Installer

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

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

Installer setConfig(Config $config)

set the config instance

Parameters

Config $config

Return Value

Installer

Installer setVerbose(bool $verbose = true)

run in verbose mode

Parameters

bool $verbose

Return Value

Installer

bool isVerbose()

Checks, if running in verbose mode.

Return Value

bool

Installer setIgnorePlatformRequirements(bool $ignorePlatformReqs = false)

set ignore Platform Package requirements

Parameters

bool $ignorePlatformReqs

Return Value

Installer

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

setWhitelistDependencies($updateDependencies = true) deprecated

deprecated use setWhitelistTransitiveDependencies instead

Parameters

$updateDependencies

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

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

Installer setPreferStable(bool $preferStable = true)

Should packages be preferred in a stable version when updating?

Parameters

bool $preferStable

Return Value

Installer

Installer setPreferLowest(bool $preferLowest = true)

Should packages be preferred in a lowest version when updating?

Parameters

bool $preferLowest

Return Value

Installer

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

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

Installer setSkipSuggest(bool $skipSuggest = true)

Should suggestions be skipped?

Parameters

bool $skipSuggest

Return Value

Installer

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

Installer setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)

Parameters

SuggestedPackagesReporter $suggestedPackagesReporter

Return Value

Installer