There isn't an integrated composer-plugin yet.
There is however composer-phrep.sh [→d25c328d8],
usable per post-install-cmd:
"scripts": {
"post-install-cmd": ["./composer-phrep.sh"],
"post-update-cmd": ["./composer-phrep.sh"]
}
Current behaviour:
It searches for packages containing a
composer.ph
alongside eachcomposer.json
. If there isn't one, the package won't be preprocessed.Rewrites all
*.src
files into*.php
scripts.Looks for a primary
composer.ph
orvendor/composer.ph
to read predefined/overriden constants from.
A full phrep composer-plugin would of course integrate more nicely, run faster than a shell script, and likely provide a few more options:
For example a
#pragma rewriterule src=php
to define which files to preprocess to which target filenames.Intersect the primary
composer.ph
defines with those from per-pkgvnd/*/*/composer.ph
includes.Or perhaps even read out
"extras": { "defines": { ... } }
- (though that might just dilute the configuration scheme, be less manageable).
However, there's no rush. There aren't any such packages yet. So feature scope and rewriting scheme are still experimental. And the shell wrapper is more flexible for testing anyway.
Foremost it also can be run independently from composer updates. For example
after changing #defines in the primary composer.ph
.