Building PHP extensions
Use @php-wasm/compile-extension when you have a phpize extension source
directory and want a distributable PHP.wasm .so plus a manifest that
loadNodeRuntime() and loadWebRuntime() can load before PHP starts.
The source directory must contain a normal PHP extension build recipe, usually
config.m4 and the C or C++ files referenced from it.
npx @php-wasm/compile-extension \
--source ./wp-mysql-parser \
--name wp_mysql_parser \
--php-versions 8.4 \
--out ./dist/wp_mysql_parser
Docker is required. The helper reuses the PHP.wasm compile image, builds a
matching PHP source tree, and runs phpize, emconfigure, and emmake with
the side-module flags expected by PHP.wasm.
Custom extensions are built for JSPI runtimes. The helper does not build Asyncify side modules.