Skip to content

Repository files navigation

Kirigami

php-wasm-compiler

Compiles PHP to WebAssembly (Docker + Emscripten) — Node.js/JSPI only.
Builds the @kirigami/php-wasm runtime for the Kirigami static site generator.

License: GPL-2.0-or-later Node.js >=24.0.0 Website


Overview

php-wasm-compiler builds our own PHP → WebAssembly toolchain, forked from the WordPress Playground @php-wasm/compile pipeline (via php-kirigami/php-wasm-builder) and trimmed to exactly what Kirigami needs:

  • ✅ JSPI (JavaScript Promise Integration) target only
  • ✅ Node.js runtime only
  • ❌ No browser build, no Asyncify

A single config.yaml drives the whole build — PHP versions, which extensions to compile in (statically today, as loadable Kirigami plugins later), and build options — with an interactive CLI or a --quiet flag for CI. See CLAUDE.md for the full architecture and decision history, and NOTICE.md for the upstream code's provenance.


Table of contents


Requirements

  • Docker
  • Node.js >= 24.0.0
  • GNU Make — ships by default on Linux/macOS, but not on Windows (install separately, e.g. via Chocolatey/Scoop/MSYS2, or run from inside WSL)
  • A POSIX shell + coreutils (sh, mkdir -p, rm -rf, mv) — also not default on Windows (Git for Windows/Git Bash or MSYS2 provide these; cmd.exe does not)
  • On Windows: WSL with an Ubuntu distro that has Node >= 24.0.0 installed

All of the above (except the WSL/Ubuntu/Node-in-WSL check, Windows-only) are checked automatically when you run node compile/cli.mjs.


Configuration

All build options live in config.yaml (PHP versions, extensions, build options) — see also matrix.json for the known versions of each third-party library.


Building the third-party libraries

Once, or after an update:

cd compile
npm install
make base-image
make all_jspi

Building PHP

cd compile

# Interactive: review/edit config.yaml before running the build
node cli.mjs

# Silent (CI): use config.yaml as-is, no prompts
node cli.mjs --quiet

# Print the commands that would run, without building
node cli.mjs --quiet --dry-run

License

GPL-2.0-or-later — inherited from the upstream WordPress Playground project. See LICENSE for the full text, and NOTICE.md for provenance details.


Author

Maxime Larrivée-Roy, 2026

About

Docker/Emscripten build pipeline compiling PHP + native extensions to WebAssembly for Kirigami's php-wasm runtime

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages