There isn't an integrated composer-plugin yet.

There is however [[→d25c328d8](artifact/d25c328d8aa7fc2d)],<br>
usable per <kbd>post-install-cmd</kbd>:

    "scripts": {
        "post-install-cmd": ["./composer-phrep.sh"],
        "post-update-cmd":  ["./composer-phrep.sh"]
    }

Current behaviour:

  * It searches for packages containing a <b>`composer.ph`</b> alongside each
    `composer.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` or `vendor/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-pkg
    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`.