\ComposerInstaller

Summary

Methods
Properties
Constants
__construct()
run()
create()
setAdditionalInstalledRepository()
setDryRun()
isDryRun()
setPreferSource()
setPreferDist()
setOptimizeAutoloader()
setClassMapAuthoritative()
setApcuAutoloader()
setUpdate()
setDevMode()
setDumpAutoloader()
setRunScripts()
setConfig()
setVerbose()
isVerbose()
setIgnorePlatformRequirements()
setUpdateWhitelist()
setWhitelistDependencies()
setWhitelistTransitiveDependencies()
setWhitelistAllDependencies()
setPreferStable()
setPreferLowest()
setWriteLock()
setExecuteOperations()
setSkipSuggest()
disablePlugins()
setSuggestedPackagesReporter()
No public properties found
No constants found
doInstall()
$io
$config
$package
$downloadManager
$repositoryManager
$locker
$installationManager
$eventDispatcher
$autoloadGenerator
$preferSource
$preferDist
$optimizeAutoloader
$classMapAuthoritative
$apcuAutoloader
$devMode
$dryRun
$verbose
$update
$dumpAutoloader
$runScripts
$ignorePlatformReqs
$preferStable
$preferLowest
$skipSuggest
$writeLock
$executeOperations
$updateWhitelist
$whitelistDependencies
$whitelistAllDependencies
$suggestedPackagesReporter
$additionalInstalledRepository
N/A
extractDevPackages()
filterDevPackageOperations()
movePluginsToFront()
moveUninstallsToFront()
createInstalledRepo()
createPool()
createPolicy()
createRequest()
processDevPackages()
getCurrentPackages()
getRootAliases()
processPackageUrls()
updatePackageUrl()
updateInstallReferences()
aliasPlatformPackages()
isUpdateable()
packageNameToRegexp()
extractPlatformRequirements()
whitelistUpdateDependencies()
mockLocalRepositories()
No private properties found
N/A

Properties

$preferSource

$preferSource : 

Type

$preferDist

$preferDist : 

Type

$optimizeAutoloader

$optimizeAutoloader : 

Type

$classMapAuthoritative

$classMapAuthoritative : 

Type

$apcuAutoloader

$apcuAutoloader : 

Type

$devMode

$devMode : 

Type

$dryRun

$dryRun : 

Type

$verbose

$verbose : 

Type

$update

$update : 

Type

$dumpAutoloader

$dumpAutoloader : 

Type

$runScripts

$runScripts : 

Type

$ignorePlatformReqs

$ignorePlatformReqs : 

Type

$preferStable

$preferStable : 

Type

$preferLowest

$preferLowest : 

Type

$skipSuggest

$skipSuggest : 

Type

$writeLock

$writeLock : 

Type

$executeOperations

$executeOperations : 

Type

$updateWhitelist

$updateWhitelist : array|null

Array of package names/globs flagged for update

Type

array|null

$whitelistDependencies

$whitelistDependencies : 

Type

$whitelistAllDependencies

$whitelistAllDependencies : 

Type

Methods

__construct()

__construct(\Composer\IO\IOInterface  $io, \Composer\Config  $config, \Composer\Package\RootPackageInterface  $package, \Composer\Downloader\DownloadManager  $downloadManager, \Composer\Repository\RepositoryManager  $repositoryManager, \Composer\Package\Locker  $locker, \Composer\Installer\InstallationManager  $installationManager, \Composer\EventDispatcher\EventDispatcher  $eventDispatcher, \Composer\Autoload\AutoloadGenerator  $autoloadGenerator) 

Constructor

Parameters

\Composer\IO\IOInterface $io
\Composer\Config $config
\Composer\Package\RootPackageInterface $package
\Composer\Downloader\DownloadManager $downloadManager
\Composer\Repository\RepositoryManager $repositoryManager
\Composer\Package\Locker $locker
\Composer\Installer\InstallationManager $installationManager
\Composer\EventDispatcher\EventDispatcher $eventDispatcher
\Composer\Autoload\AutoloadGenerator $autoloadGenerator

run()

run() : integer

Run installation (or update)

Throws

\Exception

Returns

integer —

0 on success or a positive error code on failure

setAdditionalInstalledRepository()

setAdditionalInstalledRepository(\Composer\Repository\RepositoryInterface  $additionalInstalledRepository) : $this

Parameters

\Composer\Repository\RepositoryInterface $additionalInstalledRepository

Returns

$this

setDryRun()

setDryRun(boolean  $dryRun = true) : \Composer\Installer

Whether to run in drymode or not

Parameters

boolean $dryRun

Returns

\Composer\Installer

isDryRun()

isDryRun() : boolean

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

Returns

boolean

setPreferSource()

setPreferSource(boolean  $preferSource = true) : \Composer\Installer

prefer source installation

Parameters

boolean $preferSource

Returns

\Composer\Installer

setPreferDist()

setPreferDist(boolean  $preferDist = true) : \Composer\Installer

prefer dist installation

Parameters

boolean $preferDist

Returns

\Composer\Installer

setOptimizeAutoloader()

setOptimizeAutoloader(boolean  $optimizeAutoloader = false) : \Composer\Installer

Whether or not generated autoloader are optimized

Parameters

boolean $optimizeAutoloader

Returns

\Composer\Installer

setClassMapAuthoritative()

setClassMapAuthoritative(boolean  $classMapAuthoritative = false) : \Composer\Installer

Whether or not generated autoloader considers the class map authoritative.

Parameters

boolean $classMapAuthoritative

Returns

\Composer\Installer

setApcuAutoloader()

setApcuAutoloader(boolean  $apcuAutoloader = false) : \Composer\Installer

Whether or not generated autoloader considers APCu caching.

Parameters

boolean $apcuAutoloader

Returns

\Composer\Installer

setUpdate()

setUpdate(boolean  $update = true) : \Composer\Installer

update packages

Parameters

boolean $update

Returns

\Composer\Installer

setDevMode()

setDevMode(boolean  $devMode = true) : \Composer\Installer

enables dev packages

Parameters

boolean $devMode

Returns

\Composer\Installer

setDumpAutoloader()

setDumpAutoloader(boolean  $dumpAutoloader = true) : \Composer\Installer

set whether to run autoloader or not

This is disabled implicitly when enabling dryRun

Parameters

boolean $dumpAutoloader

Returns

\Composer\Installer

setRunScripts()

setRunScripts(boolean  $runScripts = true) : \Composer\Installer

set whether to run scripts or not

This is disabled implicitly when enabling dryRun

Parameters

boolean $runScripts

Returns

\Composer\Installer

setVerbose()

setVerbose(boolean  $verbose = true) : \Composer\Installer

run in verbose mode

Parameters

boolean $verbose

Returns

\Composer\Installer

isVerbose()

isVerbose() : boolean

Checks, if running in verbose mode.

Returns

boolean

setIgnorePlatformRequirements()

setIgnorePlatformRequirements(boolean  $ignorePlatformReqs = false) : \Composer\Installer

set ignore Platform Package requirements

Parameters

boolean $ignorePlatformReqs

Returns

\Composer\Installer

setUpdateWhitelist()

setUpdateWhitelist(array  $packages) : \Composer\Installer

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

Returns

\Composer\Installer

setWhitelistDependencies()

setWhitelistDependencies(  $updateDependencies = true) 

Parameters

$updateDependencies

setWhitelistTransitiveDependencies()

setWhitelistTransitiveDependencies(boolean  $updateTransitiveDependencies = true) : \Composer\Installer

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

boolean $updateTransitiveDependencies

Returns

\Composer\Installer

setWhitelistAllDependencies()

setWhitelistAllDependencies(boolean  $updateAllDependencies = true) : \Composer\Installer

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

boolean $updateAllDependencies

Returns

\Composer\Installer

setPreferStable()

setPreferStable(boolean  $preferStable = true) : \Composer\Installer

Should packages be preferred in a stable version when updating?

Parameters

boolean $preferStable

Returns

\Composer\Installer

setPreferLowest()

setPreferLowest(boolean  $preferLowest = true) : \Composer\Installer

Should packages be preferred in a lowest version when updating?

Parameters

boolean $preferLowest

Returns

\Composer\Installer

setWriteLock()

setWriteLock(boolean  $writeLock = true) : \Composer\Installer

Should the lock file be updated when updating?

This is disabled implicitly when enabling dryRun

Parameters

boolean $writeLock

Returns

\Composer\Installer

setExecuteOperations()

setExecuteOperations(boolean  $executeOperations = true) : \Composer\Installer

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

This is disabled implicitly when enabling dryRun

Parameters

boolean $executeOperations

Returns

\Composer\Installer

setSkipSuggest()

setSkipSuggest(boolean  $skipSuggest = true) : \Composer\Installer

Should suggestions be skipped?

Parameters

boolean $skipSuggest

Returns

\Composer\Installer

disablePlugins()

disablePlugins() : \Composer\Installer

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.

Returns

\Composer\Installer

doInstall()

doInstall(\Composer\Repository\RepositoryInterface  $localRepo, \Composer\Repository\RepositoryInterface  $installedRepo, \Composer\Repository\PlatformRepository  $platformRepo, array  $aliases) : array

Parameters

\Composer\Repository\RepositoryInterface $localRepo
\Composer\Repository\RepositoryInterface $installedRepo
\Composer\Repository\PlatformRepository $platformRepo
array $aliases

Returns

array —

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

extractDevPackages()

extractDevPackages(array  $operations, \Composer\Repository\RepositoryInterface  $localRepo, \Composer\Repository\PlatformRepository  $platformRepo, array  $aliases) : array

Extracts the dev packages out of the localRepo

This works by faking the operations so we can see what the dev packages would be at the end of the operation execution. This lets us then remove the dev packages from the list of operations accordingly if we are in a --no-dev install or update.

Parameters

array $operations
\Composer\Repository\RepositoryInterface $localRepo
\Composer\Repository\PlatformRepository $platformRepo
array $aliases

Returns

array

filterDevPackageOperations()

filterDevPackageOperations(array  $devPackages, array  $operations, \Composer\Repository\RepositoryInterface  $localRepo) : array<mixed,\Composer\DependencyResolver\Operation\OperationInterface>

Parameters

array $devPackages
array $operations
\Composer\Repository\RepositoryInterface $localRepo

Returns

array<mixed,\Composer\DependencyResolver\Operation\OperationInterface> —

filtered operations, dev packages are uninstalled and all operations on them ignored

movePluginsToFront()

movePluginsToFront(array<mixed,\Composer\DependencyResolver\Operation\OperationInterface>  $operations) : array<mixed,\Composer\DependencyResolver\Operation\OperationInterface>

Workaround: if your packages depend on plugins, we must be sure that those are installed / updated first; else it would lead to packages being installed multiple times in different folders, when running Composer twice.

While this does not fix the root-causes of https://github.com/composer/composer/issues/1147, it at least fixes the symptoms and makes usage of composer possible (again) in such scenarios.

Parameters

array<mixed,\Composer\DependencyResolver\Operation\OperationInterface> $operations

Returns

array<mixed,\Composer\DependencyResolver\Operation\OperationInterface> —

reordered operation list

moveUninstallsToFront()

moveUninstallsToFront(array<mixed,\Composer\DependencyResolver\Operation\OperationInterface>  $operations) : array<mixed,\Composer\DependencyResolver\Operation\OperationInterface>

Removals of packages should be executed before installations in case two packages resolve to the same path (due to custom installers)

Parameters

array<mixed,\Composer\DependencyResolver\Operation\OperationInterface> $operations

Returns

array<mixed,\Composer\DependencyResolver\Operation\OperationInterface> —

reordered operation list

processDevPackages()

processDevPackages(\Composer\Repository\WritableRepositoryInterface  $localRepo, \Composer\DependencyResolver\Pool  $pool, \Composer\DependencyResolver\PolicyInterface  $policy, array  $repositories, \Composer\Repository\RepositoryInterface  $installedRepo, \Composer\Repository\RepositoryInterface  $lockedRepository, string  $task, array|null  $operations = null) : array

Parameters

\Composer\Repository\WritableRepositoryInterface $localRepo
\Composer\DependencyResolver\Pool $pool
\Composer\DependencyResolver\PolicyInterface $policy
array $repositories
\Composer\Repository\RepositoryInterface $installedRepo
\Composer\Repository\RepositoryInterface $lockedRepository
string $task
array|null $operations

Returns

array

getCurrentPackages()

getCurrentPackages(\Composer\Repository\RepositoryInterface  $installedRepo) : array

Loads the most "current" list of packages that are installed meaning from lock ideally or from installed repo as fallback

Parameters

\Composer\Repository\RepositoryInterface $installedRepo

Returns

array

getRootAliases()

getRootAliases() : array

Returns

array

updatePackageUrl()

updatePackageUrl(\Composer\Package\PackageInterface  $package,   $sourceUrl,   $sourceType,   $sourceReference,   $distUrl) 

Parameters

\Composer\Package\PackageInterface $package
$sourceUrl
$sourceType
$sourceReference
$distUrl

updateInstallReferences()

updateInstallReferences(\Composer\Package\PackageInterface  $package,   $reference) 

Parameters

\Composer\Package\PackageInterface $package
$reference

aliasPlatformPackages()

aliasPlatformPackages(\Composer\Repository\PlatformRepository  $platformRepo, array  $aliases) 

Parameters

\Composer\Repository\PlatformRepository $platformRepo
array $aliases

packageNameToRegexp()

packageNameToRegexp(string  $whiteListedPattern) : string

Build a regexp from a package name, expanding * globs as required

Parameters

string $whiteListedPattern

Returns

string

extractPlatformRequirements()

extractPlatformRequirements(array  $links) : array

Parameters

array $links

Returns

array

whitelistUpdateDependencies()

whitelistUpdateDependencies(\Composer\Repository\RepositoryInterface  $localOrLockRepo, array  $rootRequires, array  $rootDevRequires) 

Adds all dependencies of the update whitelist to the whitelist, too.

Packages which are listed as requirements in the root package will be skipped including their dependencies, unless they are listed in the update whitelist themselves or $whitelistAllDependencies is true.

Parameters

\Composer\Repository\RepositoryInterface $localOrLockRepo

Use the locked repo if available, otherwise installed repo will do As we want the most accurate package list to work with, and installed repo might be empty but locked repo will always be current.

array $rootRequires

An array of links to packages in require of the root package

array $rootDevRequires

An array of links to packages in require-dev of the root package

mockLocalRepositories()

mockLocalRepositories(\Composer\Repository\RepositoryManager  $rm) 

Replace local repositories with InstalledArrayRepository instances

This is to prevent any accidental modification of the existing repos on disk

Parameters

\Composer\Repository\RepositoryManager $rm