pug/installer

Enable installation callbacks on composer libraries

Installs: 76 758

Dependents: 3

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Open Issues: 0

Type:composer-plugin

1.0.1 2020-10-30 19:57 UTC

This package is auto-updated.

Last update: 2024-10-10 14:52:05 UTC


README

Latest Stable Version Build Status StyleCI Test Coverage Code Climate

Allow you to call scripts and sub-installations after package installed.

Usage

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"
    ]
}