Install & Import php-wasm
Include the module in your preferred format:
From a CDN
Using ESM modules, you can import php-wasm directly from a CDN:
jsDelivr
const { PhpWeb } = await import('https://cdn.jsdelivr.net/npm/php-wasm/PhpWeb.mjs');
const php = new PhpWeb;unpkg
const { PhpWeb } = await import('https://unpkg.com/php-wasm/PhpWeb.mjs');
const php = new PhpWeb;Installing with npm
You can also install php-wasm with npm.
Current packages
$ npm i php-wasm
$ npm i php-cgi-wasm
$ npm i php-cli-wasm
$ npm i php-dbg-wasm
$ npm i php-wasm-builderLatest nightly build
If you want the newest unpublished artifacts instead of the
npm packages, use the latest successful
Build Artifacts workflow run from GitHub
Actions.
If you specifically need the long-lived develop
artifacts, the latest successful develop-branch
build is still the February 24, 2026 run:
Build Artifactsrun#92- GitHub Actions run ID
22360005357 - Branch:
develop - Versions built: PHP
8.0through8.5 - Library modes built:
static,shared, anddynamic - Discord: nightly builds are announced in
#nightly-builds
Link:
https://github.com/seanmorris/php-wasm/actions/runs/22360005357
Pre-Packaged Static Assets:
If you’re using a bundler, use the vendor’s documentation to learn how to move the files matching the following pattern to your public directory:
node_modules/php-wasm/php8.4-web.mjs.wasm
node_modules/php-cgi-wasm/php8.4-cgi-worker.mjs.wasmImporting the module
ESM
import { PhpWeb } from 'php-wasm/PhpWeb.mjs';
const php = new PhpWeb;CommonJS Node runtimes
const { PhpNode } = require('php-wasm/PhpNode');
const php = new PhpNode({version: '8.5'});Module Format
Core Node runtimes support both ESM and CommonJS.
For 0.1.0, use the published entrypoints across
the runtime packages.
php-wasm/PhpNodephp-cgi-wasm/PhpCgiNodephp-cli-wasm/PhpCliNodephp-dbg-wasm/PhpDbgNode
Browser and worker entrypoints remain ESM-only.
Extension helper JS packages also remain ESM-only. Their
helper modules use import.meta.url to resolve
static assets, and there is no universal CommonJS equivalent for
that pattern.
When you need to manage runtime-loadable extensions from
CommonJS, load the core runtime with require() and
provide the extension .so, .data,
.wasm, and support-library assets yourself via
sharedLibs, dynamicLibs,
files, and locateFile.