As far as I know, there is no way to achieve this with the general functionality of the composer.
You can write your own scripts that will be executed in post-package-install . But scripts are only executed if they are defined in the root composer.json package (for more information on how to use scripts, see here ). The scripts defined in the dependencies are not executed for security issues (there was previously a github discussion about this).
But maybe the composer plugin fits your needs. Plugins are used to extend the functionality of composers (for more information about plugins see here ).
As a simple alternative way, I suggest defining the proposed batch message, for example: If you need XY functionality run: php composer.phar require vendor/package:2.* Then the user can use this command to install it. Not as convenient as you requested, but still easy enough for most of the users I think.
Pᴇʜ
source share