Allow you to call scripts and sub-installations after package installed.
Edit composer.json like this:
...
"require": {
"pug/installer": "*"
},
"extra": {
"installer": "MyClass::install"
},
"scripts": {
"post-install-cmd": [
"Pug\\Installer\\Installer::onAutoloadDump"
],
"post-update-cmd": [
"Pug\\Installer\\Installer::onAutoloadDump"
]
},
...
Then in your MyClass::install method (MyClass must be available via some PSR autoload you defined in composer.json).
<?php
use Composer\Script\Event;
use Pug\Installer\Installer;
class MyClass
{
public static install(Event $event, Installer, $installer)
{
$installer->install('pug/pug');
$event->getIO()->write('pug/pug has been installed');
}
}
The following will install pug/pug after your own package.
You can pass multiple installers like this:
"extra": {
"installer": [
"Foo::install",
"Bar::install"
]
}