@php-wasm/xdebug-bridge
v3.0.46
Published
XDebug bridge server for PHP.wasm
Keywords
Readme
@php-wasm/xdebug-bridge
A bridge server for XDebug and PHP.wasm that facilitates debugging connections between XDebug and Browser devtools.
Installation
npm install @php-wasm/xdebug-bridgeUsage
Programmatic API
import { startBridge } from './xdebug-bridge/src/start-bridge';
// Start with default settings
const server = startBridge();
await server.start();import { startBridge } from './xdebug-bridge/src/start-bridge';
// Start with custom configuration
const server = startBridge({
cdpHost: 'localhost', // CDP connection host
cdpPort: 9229, // CDP connection port
dbgpPort: 9003, // XDebug connection port
phpRoot: './', // Root to directory
});
await server.start();CLI Usage
# Start with default settings
npx xdebug-bridge
# Custom port and verbose logging
npx xdebug-bridge --port 9000 --verbosity debug
# Show help
npx xdebug-bridge --helpConfiguration Options (CLI)
port: Xdebug port to listen on (default: 9003)host: Xdebug host to bind to (default: 'localhost')php-root: Path to PHP root directory (default: './')verbosity: Output logs and progress messages (choices: "quiet", "normal", "debug") (default: "normal")help: Display help
Configuration Options (API)
cdpPort: Port to listen for CDP connections (default: 9229)cdpHost: Host to bind to (default: 'localhost')dbgpPort: Port to listen for XDebug connections (default: 9003)phpRoot: Root path for php filesverbosity: Output logs and progress messages (choices: "quiet", "normal", "debug") (default: "normal")phpInstance: PHP instancegetPHPFile: Custom file listing functionbreakOnFirstLine: Breaks on the first breakable line
Events
The bridge listens to events for monitoring connection activity:
From Xdebug
connected: Xdebug Server has starteddisconnected: Xdebug Server has stoppedmessage: Raw XDebug data receivederror: Xdebug Server error occurred
To Devtools
clientConnected: Devtools client connectedclientDisconnected: Devtools client disconnectedmessage: Raw Devtools data receivederror: Devtools client error occurred
