[PHP] Add php-wasm extension compile helper - #3546
Closed
adamziel wants to merge 3 commits into
Closed
Conversation
adamziel
force-pushed
the
codex/compile-extension-helper
branch
from
April 28, 2026 18:08
d98e5b9 to
446b0d2
Compare
adamziel
changed the base branch from
trunk
to
codex/phpmyadmin-cli-stabilization
April 28, 2026 18:09
adamziel
force-pushed
the
codex/compile-extension-helper
branch
from
April 28, 2026 18:21
446b0d2 to
d72542e
Compare
adamziel
force-pushed
the
codex/phpmyadmin-cli-stabilization
branch
from
April 28, 2026 18:21
e421909 to
7de936f
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
2 times, most recently
from
April 28, 2026 18:38
c5685a6 to
c741c75
Compare
adamziel
force-pushed
the
codex/phpmyadmin-cli-stabilization
branch
from
April 28, 2026 18:38
b48e8b7 to
184d0d4
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
from
April 28, 2026 19:37
c741c75 to
dcbabcf
Compare
adamziel
force-pushed
the
codex/phpmyadmin-cli-stabilization
branch
from
April 28, 2026 19:37
184d0d4 to
a3cf8e1
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
from
April 28, 2026 19:46
dcbabcf to
b281fc1
Compare
adamziel
force-pushed
the
codex/phpmyadmin-cli-stabilization
branch
from
April 28, 2026 19:46
a3cf8e1 to
fbc7354
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
from
April 28, 2026 22:30
b281fc1 to
3dc9874
Compare
adamziel
force-pushed
the
codex/phpmyadmin-cli-stabilization
branch
from
April 28, 2026 22:30
fbc7354 to
1a24793
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
from
April 28, 2026 22:54
3dc9874 to
05085dd
Compare
adamziel
force-pushed
the
codex/phpmyadmin-cli-stabilization
branch
from
April 28, 2026 22:54
1a24793 to
51912e4
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
3 times, most recently
from
April 28, 2026 23:54
22232c3 to
ad8b64d
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
2 times, most recently
from
April 29, 2026 00:13
91a1130 to
badc2a7
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
5 times, most recently
from
April 29, 2026 01:22
604756e to
a80f381
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
from
April 29, 2026 01:39
a80f381 to
09844a9
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
8 times, most recently
from
April 29, 2026 09:36
0384f94 to
34e6f19
Compare
adamziel
force-pushed
the
codex/compile-extension-helper
branch
from
April 29, 2026 09:39
34e6f19 to
f7050e8
Compare
4 tasks
Collaborator
Author
|
Superseded by #3566, which consolidates the extension loader, Blueprint API, compile helper, and bundled extension migration into one trunk-based PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Adds
@php-wasm/compile-extension, a Docker-backed CLI for compilingphpizeextension source into PHP.wasm side modules across a PHP version x async mode matrix.It writes artifacts like
wp_mysql_parser-php8.3-jspi.soplusmanifest.json, and addsloadExtension({ manifestUrl })in@php-wasm/universalto pick, fetch, verify, install, and register the matching artifact at runtime.The README now also documents dependency-backed extensions: Playground-built libraries, vendored non-Playground libraries, CMake dependencies, and plain Makefile dependencies.
Rationale
Extension authors currently have to rediscover the right
phpize, Emscripten side-module, JSPI, and Asyncify flags. The CLI gives them one command and one publishabledist/directory.Dependencies are the sharp edge: a PHP.wasm side module can only link WebAssembly objects built with the same Emscripten toolchain and async mode. The docs call out that native host libraries from
/usr/lib, Homebrew, apt, or npm packages cannot be linked into the.so.Implementation
Adds
packages/php-wasm/compile-extensionwith CLI parsing, matrix orchestration, Docker image selection, manifest writing with SHA-256 hashes, andconfig.m4extension-name detection.The canonical container recipe runs:
Side modules are built with
-sSIDE_MODULE=1,-sWASM_BIGINT,-fPIC,-O2, and the matching async flags forjspiorasyncify.Dependency archives passed through
--extra-ldflagsare kept out of configure-timeLDFLAGS, then force-linked into the final side module with--whole-archive. That lets extensions link WebAssembly.afiles without breaking Autoconf compiler smoke tests.The README includes the author workflow for CMake dependencies:
For plain Makefile dependencies, the docs show the same pattern using
emmake make,CC=emcc,CXX=em++,AR=emar, andRANLIB=emranlib. The final PHP extension still needsphpize/config.m4; CMake/Make output is treated as dependency code in v1.loadExtension()fetchesmanifest.json, matches{ phpVersion, asyncMode }, fetches the selected.so, verifiessha256when present, writes the extension and.ini, and updatesPHP_INI_SCAN_DIR.Testing instructions
Run the focused package checks:
npx nx test php-wasm-compile-extension npx nx typecheck php-wasm-compile-extension npx nx lint php-wasm-compile-extension npx nx build php-wasm-compile-extensionRun the Docker integration test:
The integration test builds and loads:
playground_helloextensionphp-srcext/calendarzlib_probeextension linked against Playground-builtlibzexternal_lib_probe, linked against a vendored non-Playgroundstring-scorearchive