Use PHP.wasm with Xdebug
There are mostly four ways to run PHP.wasm :
1. Directly from the WordPress Playground repository
cd wordpress-playground// PHP.wasm CLI
node \
--no-warnings=ExperimentalWarning \
--experimental-strip-types \
--experimental-transform-types \
--import ./packages/meta/src/node-es-module-loader/register.mts \
./packages/php-wasm/cli/src/main.ts --xdebug
// Playground CLI
node \
--no-warnings=ExperimentalWarning \
--experimental-strip-types \
--experimental-transform-types \
--import ./packages/meta/src/node-es-module-loader/register.mts \
./packages/playground/cli/src/cli.ts server --xdebug
2. Running the local-package-repository script in the WordPress Playground repository
cd wordpress-playground
npm run local-package-repository
...
http://127.0.0.1:9724/7840495c41d5c5ae535da114/v3.0.12/@php-wasm-universal-3.0.12.tar.gz
http://127.0.0.1:9724/7840495c41d5c5ae535da114/v3.0.12/@php-wasm-node-3.0.12.tar.gz
http://127.0.0.1:9724/7840495c41d5c5ae535da114/v3.0.12/@php-wasm-cli-3.0.12.tar.gz
http://127.0.0.1:9724/7840495c41d5c5ae535da114/v3.0.12/@wp-playground-cli-3.0.12.tar.gz
...The requested lines must be be added in your separate project's package.json file :
{
"type": "module",
"dependencies": {
"@php-wasm/node": "http://127.0.0.1:9724/7840495c41d5c5ae535da114/v3.0.12/@php-wasm-node-3.0.12.tar.gz",
"@php-wasm/cli": "http://127.0.0.1:9724/7840495c41d5c5ae535da114/v3.0.12/@php-wasm-cli-3.0.12.tar.gz",
"@wp-playground/cli": "http://127.0.0.1:9724/7840495c41d5c5ae535da114/v3.0.12/@wp-playground-cli-3.0.12.tar.gz"
}
}npm installnpm install @php-wasm/node @php-wasm/cli @wp-playground/clinpx @php-wasm/cli --xdebug
npx @wp-playground/cli server --xdebug- chrome-devtools
- ide