lyrixx / php-wasm-builder
Builds PHP as WebAssembly: a Dockerfile, and a castor function to build stacks (a PHP version, extensions, what to embed) with one command
Package info
github.com/lyrixx/php-wasm-builder
Language:JavaScript
pkg:composer/lyrixx/php-wasm-builder
Requires
- php: >=8.2
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v0.12.2
- v0.12.1
- v0.12.0
- v0.11.0
- v0.10.0
- v0.9.0
- v0.8.0
- v0.7.1
- v0.7.0
- v0.6.0
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.0
- v0.1.0
- dev-fs-in-worker
- dev-opcache-attributes-on-constants
- dev-serve-in-frame
- dev-zend-allocator
- dev-docs-network-compatibility
- dev-zlib-phar-zip-sodium
- dev-gd-exif
- dev-social-image
- dev-stacks-and-examples
- dev-opcache
- dev-php-in-a-worker
- dev-http-requests-and-symfony
This package is auto-updated.
Last update: 2026-11-05 18:52:57 UTC
README
Builds PHP as WebAssembly, for the browser and for node, with the PHP version and the extensions you ask for, and the code you embed.
- The documentation: https://lyrixx.github.io/php-wasm-builder/, from
docs/. - The examples, that run in your browser: https://lyrixx.github.io/php-wasm-builder/#examples.
Try it
Docker builds PHP in build/php-8.5/, node runs it:
docker buildx bake
node node/run.mjs -r 'echo "Hello from PHP ", PHP_VERSION, "\n";'
A page imports php-web.mjs, and runs PHP:
<script type="module"> import createPhp from './build/php-8.5/php-web.mjs'; const php = await createPhp(); const { stdout } = await php.runCode('echo PHP_VERSION;'); </script>
To build PHP for a page of your own, with your code, from your project: see Use it in your project.
Where things are
docker/: the Dockerfile that compiles PHP, and the JavaScript API of what it builds;stacks.php: the builds that this repository checks, in CI too;examples/: the examples of the website, a directory each, laid out as a project of your own would be:stack.php,public/, andapp/;docs/andzensical.toml: the documentation, and the website;CHANGELOG.md: what changes, that the website shows too;castor.phpandsrc/: the tasks that build, check and serve all of it,castor listlists them;node/andtests/: what runs PHP in node, and tests it.
Credits
This builder was created by Derick Rethans, for
The PHP Foundation, in
derickr/php-wasm-builder, the builder of the PHP WASM
files of the php.net documentation. What runs PHP, docker/run.c, comes from the work of
Antoine Bluchet. Both are under the MIT license, see LICENSE. The
documentation thanks everyone else, see
Credits.