Composer package can include vendor binary. If my repository has a file "bin/foobar.phar" in it, I can add this to my composer.json:
{
"name": "foobar/cli",
"bin": ["bin/foobar.phar"]
}
Then when I install this "foobar/cli" package, the file "bin/foobar.phar" will be installed to "vendor/bin".
My question is how do I do this without commiting the "bin/foobar.phar" file to my repository? Let say I can build the file by running the script "composer build":
{
"name": "foobar/cli",
"scripts": {
"build": "@php build.php --target=./bin/foobar.phar"
},
"bin": ["bin/foobar.phar"]
}
How do I setup my repository so the bin target is built when installed by project depends on "foobar/cli"?
I've tried to put "@composer build" into the following event hooks, none seems to work:
- pre-install-cmd
- post-install-cmd
- pre-update-cmd
- post-update-cmd
- pre-package-install
- post-package-install
- pre-package-update
- post-package-update
Package like phpunit seems to have pulled this off. There should be a way for it.
Please suggest what I should try. Thanks.