Installer
in package
Tags
Table of Contents
- $additionalInstalledRepository : RepositoryInterface
- $apcuAutoloader : mixed
- $autoloadGenerator : AutoloadGenerator
- $classMapAuthoritative : mixed
- $config : Config
- $devMode : mixed
- $downloadManager : DownloadManager
- $dryRun : mixed
- $dumpAutoloader : mixed
- $eventDispatcher : EventDispatcher
- $executeOperations : mixed
- $ignorePlatformReqs : mixed
- $installationManager : InstallationManager
- $io : IOInterface
- $locker : Locker
- $optimizeAutoloader : mixed
- $package : RootPackageInterface
- $preferDist : mixed
- $preferLowest : mixed
- $preferSource : mixed
- $preferStable : mixed
- $repositoryManager : RepositoryManager
- $runScripts : mixed
- $skipSuggest : mixed
- $suggestedPackagesReporter : SuggestedPackagesReporter
- $update : mixed
- $updateWhitelist : array<string|int, mixed>|null
- Array of package names/globs flagged for update
- $verbose : mixed
- $whitelistAllDependencies : mixed
- $whitelistDependencies : mixed
- $writeLock : mixed
- __construct() : mixed
- Constructor
- create() : Installer
- Create Installer
- disablePlugins() : Installer
- Disables plugins.
- isDryRun() : bool
- Checks, if this is a dry run (simulation mode).
- isVerbose() : bool
- Checks, if running in verbose mode.
- run() : int
- Run installation (or update)
- setAdditionalInstalledRepository() : $this
- setAllowListAllDependencies() : Installer
- Should all dependencies of allowed packages be updated recursively?
- setAllowListTransitiveDependencies() : Installer
- Should dependencies of allowed packages (but not direct dependencies) be updated?
- setApcuAutoloader() : Installer
- Whether or not generated autoloader considers APCu caching.
- setClassMapAuthoritative() : Installer
- Whether or not generated autoloader considers the class map authoritative.
- setConfig() : Installer
- set the config instance
- setDevMode() : Installer
- enables dev packages
- setDryRun() : Installer
- Whether to run in drymode or not
- setDumpAutoloader() : Installer
- set whether to run autoloader or not
- setExecuteOperations() : Installer
- Should the operations (package install, update and removal) be executed on disk?
- setIgnorePlatformRequirements() : Installer
- set ignore Platform Package requirements
- setOptimizeAutoloader() : Installer
- Whether or not generated autoloader are optimized
- setPreferDist() : Installer
- prefer dist installation
- setPreferLowest() : Installer
- Should packages be preferred in a lowest version when updating?
- setPreferSource() : Installer
- prefer source installation
- setPreferStable() : Installer
- Should packages be preferred in a stable version when updating?
- setRunScripts() : Installer
- set whether to run scripts or not
- setSkipSuggest() : Installer
- Should suggestions be skipped?
- setSuggestedPackagesReporter() : Installer
- setUpdate() : Installer
- update packages
- setUpdateAllowList() : Installer
- restrict the update operation to a few packages, all other packages that are already installed will be kept at their current version
- setUpdateWhitelist() : Installer
- restrict the update operation to a few packages, all other packages that are already installed will be kept at their current version
- setVerbose() : Installer
- run in verbose mode
- setWhitelistAllDependencies() : Installer
- Should all dependencies of allowed packages be updated recursively?
- setWhitelistDependencies() : mixed
- setWhitelistTransitiveDependencies() : Installer
- Should dependencies of allowed packages (but not direct dependencies) be updated?
- setWriteLock() : Installer
- Should the lock file be updated when updating?
- doInstall() : array<string|int, mixed>
- aliasPlatformPackages() : mixed
- allowListUpdateDependencies() : mixed
- Adds all dependencies of the update allow list to the allow list, too.
- createInstalledRepo() : RepositoryInterface
- createPolicy() : DefaultPolicy
- createPool() : Pool
- createRequest() : Request
- extractDevPackages() : array<string|int, mixed>
- Extracts the dev packages out of the localRepo
- extractPlatformRequirements() : array<string|int, mixed>
- filterDevPackageOperations() : array<string|int, OperationInterface>
- getCurrentPackages() : array<string|int, mixed>
- Loads the most "current" list of packages that are installed meaning from lock ideally or from installed repo as fallback
- getRootAliases() : array<string|int, mixed>
- isUpdateable() : bool
- mockLocalRepositories() : mixed
- Replace local repositories with InstalledArrayRepository instances
- movePluginsToFront() : array<string|int, 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.
- moveUninstallsToFront() : array<string|int, OperationInterface>
- Removals of packages should be executed before installations in case two packages resolve to the same path (due to custom installers)
- processDevPackages() : array<string|int, mixed>
- processPackageUrls() : mixed
- updateInstallReferences() : mixed
- updatePackageUrl() : mixed
Properties
$additionalInstalledRepository
protected
RepositoryInterface
$additionalInstalledRepository
$apcuAutoloader
protected
mixed
$apcuAutoloader
= false
$autoloadGenerator
protected
AutoloadGenerator
$autoloadGenerator
$classMapAuthoritative
protected
mixed
$classMapAuthoritative
= false
$config
protected
Config
$config
$devMode
protected
mixed
$devMode
= false
$downloadManager
protected
DownloadManager
$downloadManager
$dryRun
protected
mixed
$dryRun
= false
$dumpAutoloader
protected
mixed
$dumpAutoloader
= true
$eventDispatcher
protected
EventDispatcher
$eventDispatcher
$executeOperations
protected
mixed
$executeOperations
= true
$ignorePlatformReqs
protected
mixed
$ignorePlatformReqs
= false
$installationManager
protected
InstallationManager
$installationManager
$io
protected
IOInterface
$io
$locker
protected
Locker
$locker
$optimizeAutoloader
protected
mixed
$optimizeAutoloader
= false
$package
protected
RootPackageInterface
$package
$preferDist
protected
mixed
$preferDist
= false
$preferLowest
protected
mixed
$preferLowest
= false
$preferSource
protected
mixed
$preferSource
= false
$preferStable
protected
mixed
$preferStable
= false
$repositoryManager
protected
RepositoryManager
$repositoryManager
$runScripts
protected
mixed
$runScripts
= true
$skipSuggest
protected
mixed
$skipSuggest
= false
$suggestedPackagesReporter
protected
SuggestedPackagesReporter
$suggestedPackagesReporter
$update
protected
mixed
$update
= false
$updateWhitelist
Array of package names/globs flagged for update
protected
array<string|int, mixed>|null
$updateWhitelist
= null
$verbose
protected
mixed
$verbose
= false
$whitelistAllDependencies
protected
mixed
$whitelistAllDependencies
= false
$whitelistDependencies
protected
mixed
$whitelistDependencies
= false
$writeLock
protected
mixed
$writeLock
Methods
__construct()
Constructor
public
__construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator) : mixed
Parameters
- $io : IOInterface
- $config : Config
- $package : RootPackageInterface
- $downloadManager : DownloadManager
- $repositoryManager : RepositoryManager
- $locker : Locker
- $installationManager : InstallationManager
- $eventDispatcher : EventDispatcher
- $autoloadGenerator : AutoloadGenerator
Return values
mixed —create()
Create Installer
public
static create(IOInterface $io, Composer $composer) : Installer
Parameters
- $io : IOInterface
- $composer : Composer
Return values
Installer —disablePlugins()
Disables plugins.
public
disablePlugins() : Installer
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 values
Installer —isDryRun()
Checks, if this is a dry run (simulation mode).
public
isDryRun() : bool
Return values
bool —isVerbose()
Checks, if running in verbose mode.
public
isVerbose() : bool
Return values
bool —run()
Run installation (or update)
public
run() : int
Tags
Return values
int —0 on success or a positive error code on failure
setAdditionalInstalledRepository()
public
setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository) : $this
Parameters
- $additionalInstalledRepository : RepositoryInterface
Return values
$this —setAllowListAllDependencies()
Should all dependencies of allowed packages be updated recursively?
public
setAllowListAllDependencies([bool $updateAllDependencies = true ]) : Installer
This will allow list any dependencies of the allow listed packages, including those defined in the root package.
Parameters
- $updateAllDependencies : bool = true
Return values
Installer —setAllowListTransitiveDependencies()
Should dependencies of allowed packages (but not direct dependencies) be updated?
public
setAllowListTransitiveDependencies([bool $updateTransitiveDependencies = true ]) : Installer
This will NOT allow list any dependencies that are also directly defined in the root package.
Parameters
- $updateTransitiveDependencies : bool = true
Return values
Installer —setApcuAutoloader()
Whether or not generated autoloader considers APCu caching.
public
setApcuAutoloader([bool $apcuAutoloader = false ]) : Installer
Parameters
- $apcuAutoloader : bool = false
Return values
Installer —setClassMapAuthoritative()
Whether or not generated autoloader considers the class map authoritative.
public
setClassMapAuthoritative([bool $classMapAuthoritative = false ]) : Installer
Parameters
- $classMapAuthoritative : bool = false
Return values
Installer —setConfig()
set the config instance
public
setConfig(Config $config) : Installer
Parameters
- $config : Config
Return values
Installer —setDevMode()
enables dev packages
public
setDevMode([bool $devMode = true ]) : Installer
Parameters
- $devMode : bool = true
Return values
Installer —setDryRun()
Whether to run in drymode or not
public
setDryRun([bool $dryRun = true ]) : Installer
Parameters
- $dryRun : bool = true
Return values
Installer —setDumpAutoloader()
set whether to run autoloader or not
public
setDumpAutoloader([bool $dumpAutoloader = true ]) : Installer
This is disabled implicitly when enabling dryRun
Parameters
- $dumpAutoloader : bool = true
Return values
Installer —setExecuteOperations()
Should the operations (package install, update and removal) be executed on disk?
public
setExecuteOperations([bool $executeOperations = true ]) : Installer
This is disabled implicitly when enabling dryRun
Parameters
- $executeOperations : bool = true
Return values
Installer —setIgnorePlatformRequirements()
set ignore Platform Package requirements
public
setIgnorePlatformRequirements([bool $ignorePlatformReqs = false ]) : Installer
Parameters
- $ignorePlatformReqs : bool = false
Return values
Installer —setOptimizeAutoloader()
Whether or not generated autoloader are optimized
public
setOptimizeAutoloader([bool $optimizeAutoloader = false ]) : Installer
Parameters
- $optimizeAutoloader : bool = false
Return values
Installer —setPreferDist()
prefer dist installation
public
setPreferDist([bool $preferDist = true ]) : Installer
Parameters
- $preferDist : bool = true
Return values
Installer —setPreferLowest()
Should packages be preferred in a lowest version when updating?
public
setPreferLowest([bool $preferLowest = true ]) : Installer
Parameters
- $preferLowest : bool = true
Return values
Installer —setPreferSource()
prefer source installation
public
setPreferSource([bool $preferSource = true ]) : Installer
Parameters
- $preferSource : bool = true
Return values
Installer —setPreferStable()
Should packages be preferred in a stable version when updating?
public
setPreferStable([bool $preferStable = true ]) : Installer
Parameters
- $preferStable : bool = true
Return values
Installer —setRunScripts()
set whether to run scripts or not
public
setRunScripts([bool $runScripts = true ]) : Installer
This is disabled implicitly when enabling dryRun
Parameters
- $runScripts : bool = true
Return values
Installer —setSkipSuggest()
Should suggestions be skipped?
public
setSkipSuggest([bool $skipSuggest = true ]) : Installer
Parameters
- $skipSuggest : bool = true
Return values
Installer —setSuggestedPackagesReporter()
public
setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter) : Installer
Parameters
- $suggestedPackagesReporter : SuggestedPackagesReporter
Return values
Installer —setUpdate()
update packages
public
setUpdate([bool $update = true ]) : Installer
Parameters
- $update : bool = true
Return values
Installer —setUpdateAllowList()
restrict the update operation to a few packages, all other packages that are already installed will be kept at their current version
public
setUpdateAllowList(array<string|int, mixed> $packages) : Installer
Parameters
- $packages : array<string|int, mixed>
Return values
Installer —setUpdateWhitelist()
restrict the update operation to a few packages, all other packages that are already installed will be kept at their current version
public
setUpdateWhitelist(array<string|int, mixed> $packages) : Installer
Parameters
- $packages : array<string|int, mixed>
Tags
Return values
Installer —setVerbose()
run in verbose mode
public
setVerbose([bool $verbose = true ]) : Installer
Parameters
- $verbose : bool = true
Return values
Installer —setWhitelistAllDependencies()
Should all dependencies of allowed packages be updated recursively?
public
setWhitelistAllDependencies([bool $updateAllDependencies = true ]) : Installer
This will allow list any dependencies of the allow listed packages, including those defined in the root package.
Parameters
- $updateAllDependencies : bool = true
Tags
Return values
Installer —setWhitelistDependencies()
public
setWhitelistDependencies([mixed $updateDependencies = true ]) : mixed
Parameters
- $updateDependencies : mixed = true
Tags
Return values
mixed —setWhitelistTransitiveDependencies()
Should dependencies of allowed packages (but not direct dependencies) be updated?
public
setWhitelistTransitiveDependencies([bool $updateTransitiveDependencies = true ]) : Installer
This will NOT allow list any dependencies that are also directly defined in the root package.
Parameters
- $updateTransitiveDependencies : bool = true
Tags
Return values
Installer —setWriteLock()
Should the lock file be updated when updating?
public
setWriteLock([bool $writeLock = true ]) : Installer
This is disabled implicitly when enabling dryRun
Parameters
- $writeLock : bool = true
Return values
Installer —doInstall()
protected
doInstall(RepositoryInterface $localRepo, RepositoryInterface $installedRepo, PlatformRepository $platformRepo, array<string|int, mixed> $aliases) : array<string|int, mixed>
Parameters
- $localRepo : RepositoryInterface
- $installedRepo : RepositoryInterface
- $platformRepo : PlatformRepository
- $aliases : array<string|int, mixed>
Return values
array<string|int, mixed> —[int, PackageInterfaces[]|null] with the exit code and an array of dev packages on update, or null on install
aliasPlatformPackages()
private
aliasPlatformPackages(PlatformRepository $platformRepo, array<string|int, mixed> $aliases) : mixed
Parameters
- $platformRepo : PlatformRepository
- $aliases : array<string|int, mixed>
Return values
mixed —allowListUpdateDependencies()
Adds all dependencies of the update allow list to the allow list, too.
private
allowListUpdateDependencies(RepositoryInterface $localOrLockRepo, array<string|int, mixed> $rootRequires, array<string|int, mixed> $rootDevRequires) : mixed
Packages which are listed as requirements in the root package will be skipped including their dependencies, unless they are listed in the update allow list themselves or $whitelistAllDependencies is true.
Parameters
- $localOrLockRepo : RepositoryInterface
-
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.
- $rootRequires : array<string|int, mixed>
-
An array of links to packages in require of the root package
- $rootDevRequires : array<string|int, mixed>
-
An array of links to packages in require-dev of the root package
Return values
mixed —createInstalledRepo()
private
createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo) : RepositoryInterface
Parameters
- $localRepo : RepositoryInterface
- $platformRepo : PlatformRepository
Return values
RepositoryInterface —createPolicy()
private
createPolicy() : DefaultPolicy
Return values
DefaultPolicy —createPool()
private
createPool([RepositoryInterface|null $lockedRepository = null ]) : Pool
Parameters
- $lockedRepository : RepositoryInterface|null = null
Return values
Pool —createRequest()
private
createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo) : Request
Parameters
- $rootPackage : RootPackageInterface
- $platformRepo : PlatformRepository
Return values
Request —extractDevPackages()
Extracts the dev packages out of the localRepo
private
extractDevPackages(array<string|int, mixed> $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array<string|int, mixed> $aliases) : array<string|int, mixed>
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
- $operations : array<string|int, mixed>
- $localRepo : RepositoryInterface
- $platformRepo : PlatformRepository
- $aliases : array<string|int, mixed>
Return values
array<string|int, mixed> —extractPlatformRequirements()
private
extractPlatformRequirements(array<string|int, mixed> $links) : array<string|int, mixed>
Parameters
- $links : array<string|int, mixed>
Return values
array<string|int, mixed> —filterDevPackageOperations()
private
filterDevPackageOperations(array<string|int, mixed> $devPackages, array<string|int, mixed> $operations, RepositoryInterface $localRepo) : array<string|int, OperationInterface>
Parameters
- $devPackages : array<string|int, mixed>
- $operations : array<string|int, mixed>
- $localRepo : RepositoryInterface
Return values
array<string|int, OperationInterface> —filtered operations, dev packages are uninstalled and all operations on them ignored
getCurrentPackages()
Loads the most "current" list of packages that are installed meaning from lock ideally or from installed repo as fallback
private
getCurrentPackages(RepositoryInterface $installedRepo) : array<string|int, mixed>
Parameters
- $installedRepo : RepositoryInterface
Return values
array<string|int, mixed> —getRootAliases()
private
getRootAliases() : array<string|int, mixed>
Return values
array<string|int, mixed> —isUpdateable()
private
isUpdateable(PackageInterface $package) : bool
Parameters
- $package : PackageInterface
Return values
bool —mockLocalRepositories()
Replace local repositories with InstalledArrayRepository instances
private
mockLocalRepositories(RepositoryManager $rm) : mixed
This is to prevent any accidental modification of the existing repos on disk
Parameters
- $rm : RepositoryManager
Return values
mixed —movePluginsToFront()
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.
private
movePluginsToFront(array<string|int, OperationInterface> $operations) : array<string|int, OperationInterface>
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
- $operations : array<string|int, OperationInterface>
Return values
array<string|int, OperationInterface> —reordered operation list
moveUninstallsToFront()
Removals of packages should be executed before installations in case two packages resolve to the same path (due to custom installers)
private
moveUninstallsToFront(array<string|int, OperationInterface> $operations) : array<string|int, OperationInterface>
Parameters
- $operations : array<string|int, OperationInterface>
Return values
array<string|int, OperationInterface> —reordered operation list
processDevPackages()
private
processDevPackages(WritableRepositoryInterface $localRepo, Pool $pool, PolicyInterface $policy, array<string|int, mixed> $repositories, RepositoryInterface $installedRepo, RepositoryInterface $lockedRepository, string $task[, array<string|int, mixed>|null $operations = null ]) : array<string|int, mixed>
Parameters
- $localRepo : WritableRepositoryInterface
- $pool : Pool
- $policy : PolicyInterface
- $repositories : array<string|int, mixed>
- $installedRepo : RepositoryInterface
- $lockedRepository : RepositoryInterface
- $task : string
- $operations : array<string|int, mixed>|null = null
Return values
array<string|int, mixed> —processPackageUrls()
private
processPackageUrls(Pool $pool, PolicyInterface $policy, WritableRepositoryInterface $localRepo, array<string|int, mixed> $repositories) : mixed
Parameters
- $pool : Pool
- $policy : PolicyInterface
- $localRepo : WritableRepositoryInterface
- $repositories : array<string|int, mixed>
Return values
mixed —updateInstallReferences()
private
updateInstallReferences(PackageInterface $package, mixed $reference) : mixed
Parameters
- $package : PackageInterface
- $reference : mixed
Return values
mixed —updatePackageUrl()
private
updatePackageUrl(PackageInterface $package, mixed $sourceUrl, mixed $sourceType, mixed $sourceReference, mixed $distUrl, mixed $distType, mixed $distShaSum) : mixed
Parameters
- $package : PackageInterface
- $sourceUrl : mixed
- $sourceType : mixed
- $sourceReference : mixed
- $distUrl : mixed
- $distType : mixed
- $distShaSum : mixed