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.phalongside eachcomposer.json. If there isn't one, the package won't be preprocessed.Rewrites all
*.srcfiles into*.phpscripts.Looks for a primary
composer.phorvendor/composer.phto 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=phpto define which files to preprocess to which target filenames.Intersect the primary
composer.phdefines with those from per-pkgvnd/*/*/composer.phincludes.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.