composer/composer — pull request #3082 by francoispluchino (2014-06-29 18:01:10+00:00)
Title: Installs plugins and dependencies before installation of other packages

| Q | A
| ------------- | -------------------------------
| Bug fix? | yes (installation plugin order)
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #2972, #2879, #2878, #1121, #3078
| License | MIT

This feature allows installing plugins and their dependencies before restarting the installation of other packages in the project. It allows the plugins to be added directly in the project and must not be installed in global.

With this feature it is for example possible to create a plugin adding automatically the repositories, without that Composer throws an error when the first installation.

It does not change the original behavior of the install, but at the same time, fixes a "strange" behavior of the order of the installation of plugins and their dependencies.

The dependencies plugins must be installed before the plugin, then the plugin must be installed, and then the rest of dépedances can be installed.

Test example:

```json
{
"repositories": [
{
"type": "package",
"package": [
{ "name": "pkg", "version": "1.0.0" },
{ "name": "pkg2", "version": "1.0.0" },
{ "name": "inst", "version": "1.0.0", "type": "composer-plugin" },
{ "name": "inst2", "version": "1.0.0", "type": "composer-plugin", "require": { "pkg2": "*" } }
]
}
],
"require": {
"pkg": "1.0.0",
"inst": "1.0.0",
"inst2": "1.0.0"
}
}
```

The order should be:

```
Installing inst (1.0.0)
Installing pkg2 (1.0.0)
Installing inst2 (1.0.0)
Installing pkg (1.0.0)
```

and not (actually):

```
Installing inst (1.0.0)
Installing pkg (1.0.0)
Installing pkg2 (1.0.0)
Installing inst2 (1.0.0)
```