Properties

$composer

$composer : 

Type

$io

$io : 

Type

$globalComposer

$globalComposer : 

Type

$versionParser

$versionParser : 

Type

$disablePlugins

$disablePlugins : 

Type

$plugins

$plugins : 

Type

$registeredPlugins

$registeredPlugins : 

Type

$classCounter

$classCounter : 

Type

Methods

__construct()

__construct(\Composer\IO\IOInterface  $io, \Composer\Composer  $composer, \Composer\Composer  $globalComposer = null, boolean  $disablePlugins = false) 

Initializes plugin manager

Parameters

\Composer\IO\IOInterface $io
\Composer\Composer $composer
\Composer\Composer $globalComposer
boolean $disablePlugins

loadInstalledPlugins()

loadInstalledPlugins() 

Loads all plugins from currently installed plugin packages

getPlugins()

getPlugins() : array

Gets all currently active plugin instances

Returns

array —

plugins

getGlobalComposer()

getGlobalComposer() : \Composer\Composer|null

Gets global composer or null when main composer is not fully loaded

Returns

\Composer\Composer|null

registerPackage()

registerPackage(\Composer\Package\PackageInterface  $package, boolean  $failOnMissingClasses = false) 

Register a plugin package, activate it etc.

If it's of type composer-installer it is registered as an installer instead for BC

Parameters

\Composer\Package\PackageInterface $package
boolean $failOnMissingClasses

By default this silently skips plugins that can not be found, but if set to true it fails with an exception

Throws

\UnexpectedValueException

addPlugin()

addPlugin(\Composer\Plugin\PluginInterface  $plugin) 

Adds a plugin, activates it and registers it with the event dispatcher

Ideally plugin packages should be registered via registerPackage, but if you use Composer programmatically and want to register a plugin class directly this is a valid way to do it.

Parameters

\Composer\Plugin\PluginInterface $plugin

plugin instance

getPluginCapability()

getPluginCapability(\Composer\Plugin\PluginInterface  $plugin, string  $capabilityClassName, array  $ctorArgs = array()) : null|\Composer\Plugin\Capability\Capability

Parameters

\Composer\Plugin\PluginInterface $plugin
string $capabilityClassName

The fully qualified name of the API interface which the plugin may provide an implementation of.

array $ctorArgs

Arguments passed to Capability's constructor. Keeping it an array will allow future values to be passed w\o changing the signature.

Returns

null|\Composer\Plugin\Capability\Capability

getPluginCapabilities()

getPluginCapabilities(string  $capabilityClassName, array  $ctorArgs = array()) : array<mixed,\Composer\Plugin\Capability\Capability>

Parameters

string $capabilityClassName

The fully qualified name of the API interface which the plugin may provide an implementation of.

array $ctorArgs

Arguments passed to Capability's constructor. Keeping it an array will allow future values to be passed w\o changing the signature.

Returns

array<mixed,\Composer\Plugin\Capability\Capability>

getPluginApiVersion()

getPluginApiVersion() : string

Returns the version of the internal composer-plugin-api package.

Returns

string

getCapabilityImplementationClassName()

getCapabilityImplementationClassName(\Composer\Plugin\PluginInterface  $plugin, string  $capability) : null|string

Parameters

\Composer\Plugin\PluginInterface $plugin
string $capability

Throws

\RuntimeException

On empty or non-string implementation class name value

Returns

null|string —

The fully qualified class of the implementation or null if Plugin is not of Capable type or does not provide it

loadRepository()

loadRepository(\Composer\Repository\RepositoryInterface  $repo) 

Load all plugins and installers from a repository

Note that plugins in the specified repository that rely on events that have fired prior to loading will be missed. This means you likely want to call this method as early as possible.

Parameters

\Composer\Repository\RepositoryInterface $repo

Repository to scan for plugins to install

Throws

\RuntimeException

collectDependencies()

collectDependencies(\Composer\DependencyResolver\Pool  $pool, array  $collected, \Composer\Package\PackageInterface  $package) : array

Recursively generates a map of package names to packages for all deps

Parameters

\Composer\DependencyResolver\Pool $pool

Package pool of installed packages

array $collected

Current state of the map for recursion

\Composer\Package\PackageInterface $package

The package to analyze

Returns

array —

Map of package names to packages

lookupInstalledPackage()

lookupInstalledPackage(\Composer\DependencyResolver\Pool  $pool, \Composer\Package\Link  $link) : \Composer\Package\PackageInterface|null

Resolves a package link to a package in the installed pool

Since dependencies are already installed this should always find one.

Parameters

\Composer\DependencyResolver\Pool $pool

Pool of installed packages only

\Composer\Package\Link $link

Package link to look up

Returns

\Composer\Package\PackageInterface|null —

The found package

getInstallPath()

getInstallPath(\Composer\Package\PackageInterface  $package, boolean  $global = false) : string

Retrieves the path a package is installed to.

Parameters

\Composer\Package\PackageInterface $package
boolean $global

Whether this is a global package

Returns

string —

Install path