Use it in your project¶
The Dockerfile knows which emsdk works, how to cross-compile oniguruma and libxml2, which
./configure flags PHP needs to link, and which emcc flags make it load. A PHP project reuses it
by requiring the package, instead of copying it. These pages show how a project builds PHP with its
code in it, runs it in a page, checks it, and deploys it:
- Build it, with the code of the project;
- run it in the page;
- check it, without a browser;
- deploy it, to GitHub Pages.
Each step is shown with castor, that declares the build in PHP, and checks it, and with Composer and Docker only. Pick one: the other pages remember it. The pages built with it use castor.
Require the package¶
It writes castor.composer.json and castor.composer.lock, to commit, and installs the package
in .castor/vendor/. The project gets PhpWasm\build() and PhpWasm\Stack, but no task: the
tasks of this repository build its own stacks.
Git ignores what is installed, and what is built:
It needs Docker, castor, and node for the checks.
It brings the Dockerfile, in vendor/lyrixx/php-wasm-builder/docker/, and
vendor/lyrixx/php-wasm-builder/node/run.mjs, that runs PHP in node. It is a dev dependency:
it builds the page, the code of the project does not need it.
Git ignores what is built:
It needs Docker, and node for the checks.