Composer Installers Extender
The composer-installers-extender
is a plugin for Composer that allows
any package to be installed to a directory other than the default vendor
directory within a project on a package-by-package basis. This plugin extends
the [composer/installers
][] plugin to allow any arbitrary package type to be
handled by their custom installer., (*1)
The [composer/installers
][] plugin has a finite set of supported package types
and we recognize the need for any arbitrary package type to be installed to a
specific directory other than vendor
. This plugin allows additional package
types to be handled by the [composer/installers
][] plugin, benefiting from
their explicit install path mapping and token replacement of package properties., (*2)
How to Install
Add oomphinc/composer-installers-extender
as a dependency of your project:, (*3)
$ composer require oomphinc/composer-installers-extender
This plugin requires at least PHP 7.1. If you're using a lower version of PHP
use the latest stable 1.x release:, (*4)
$ composer require oomphinc/composer-installers-extender:^1.1
How to Use
The [composer/installers
][] plugin is a dependency of this plugin and will be
automatically required as well if not already required., (*5)
To support additional package types, add an array of these types in the
extra
property in your composer.json
:, (*6)
with [composer/installers
][] < v1.0.13:, (*7)
{
"extra": {
"installer-types": ["library"]
}
}
with [composer/installers
][] >= v1.0.13:, (*8)
{
"extra": {
"installer-types": ["drupal-library"]
}
}
Then refer to that type when adding to installer-paths
:, (*9)
with [composer/installers
][] < v1.0.13:, (*10)
{
"extra": {
"installer-types": ["library"],
"installer-paths": {
"special/package/": ["my/package"],
"path/to/libraries/{$name}/": ["type:library"]
}
}
}
with [composer/installers
][] >= v1.0.13:, (*11)
{
"extra": {
"installer-types": ["drupal-library"],
"installer-paths": {
"special/package/": ["my/package"],
"path/to/libraries/{$name}/": ["type:drupal-library"]
}
}
}
By default, packages that do not specify a type
will be considered the type
library
. Adding support for this type allows any of these packages to be
placed in a different install path., (*12)
If a type has been added to installer-types
, the plugin will attempt to find
an explicit installer path in the mapping. If there is no match either by name
or by type, the default installer path for all packages will be used instead., (*13)
Please see the README for [composer/installers
][] to see the supported syntax
for package and type matching as well as the supported replacement tokens in
the path (e.g. {$name}
)., (*14)
License
MIT License, (*15)