Composer won't execute post require hooks when installing from

Skip to first unread message

Python Coder

Nov 25, 2015, 10:27:45 AM11/25/15
to composer-dev
Hey everyone

I am trying to execute a php script when a composer module is installed when issuing a command such as composer require vendor/package-name.

The composer json of the package looks like this:

{ "name": "vendor/package-name", "description": "some description", "type": "library", "license": "MIT", "authors": [{ "name": "author", "email": "", "homepage": "" }], "minimum-stability": "stable", "require": { "php": ">=5.3.0" }, "autoload": { "psr-4": {"PmbaTestPackage\\": "src/"} }, "scripts": { "pre-install-cmd": [ "php src/notify.php" ], "post-update-cmd": [ "php src/notify.php" ] }, "version": "1.0.1" }

And I want to execute the script at php/notify.php when the module is required. I looked at the hooks described here:

But it doesn't work, no hooks are executed? What is the reason?

Hari K T

Nov 25, 2015, 11:30:31 AM11/25/15
It should work like a charm.

Try this example. composer.json

    "scripts": {
        "post-update-cmd": "touch hello.txt"

composer require aura/auth

If you look at your directory you will see a hello.txt .

I feel there is some issue on the notify script or execution of script.

Thank you

Hari K T

You can ring me : +91 9388 75 8821

Skype  : kthari85
Twitter : harikt

You received this message because you are subscribed to the "composer-dev" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

You received this message because you are subscribed to the Google Groups "composer-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Christophe COEVOET

Nov 25, 2015, 11:42:18 AM11/25/15
Only hooks of the root package are executed, as explained in the composer documentation
Christophe | Stof
Reply all
Reply to author
0 new messages