composer/composer — pull request #1951 by nicoschoenmaker (2013-05-30 14:19:32+00:00)
Title: Allow to bind closures to the EventDispatcher

There are right now two ways that I know of that are possible to allow to get a trigger in a custom installer
- in the ```__destruct()``` (ugly)
- in the supports function ([example](https://github.com/RobLoach/component-installer/blob/master/src/ComponentInstaller/Installer.php#L45-L51)). Less ugly, but still not nice.

I would like to be able to subscribe to events because I'm building a custom installer that does some code generation based on the contents of the to-be-installed package. Part of the code that I generate depends on the combination of the installed packages.

i.e. I generate some "glue" between them. So I need a hook where I can get the complete list of packages, after they have all been installed.

My gut feeling told me to bind to the EventDispatcher, but there was no possibility for that. Hence this pull request + unit tests :)