php-wasm is a WebAssembly-powered runtime that enables PHP to run entirely inside the browser or JavaScript environments without requiring a traditional server setup. It compiles PHP into WebAssembly and exposes it through JavaScript APIs, allowing developers to execute PHP scripts directly in web pages, service workers, or Node.js contexts. One of its most distinctive capabilities is the introduction of a CGI-style runtime that mimics how PHP operates under web servers like Apache or Nginx, enabling full HTTP request handling directly in the browser. This allows developers to build fully client-side applications that behave like server-rendered PHP sites, including support for routing, AJAX requests, and dynamic page generation. The system also supports persistent memory, filesystem access, and integration with browser APIs, making it suitable for complex applications rather than simple demos.
Features
- Run PHP directly in the browser using WebAssembly
- CGI-style execution mode with HTTP request handling
- Integration with service workers for server-like behavior
- Persistent memory and virtual filesystem support
- Direct interaction between PHP and JavaScript/DOM
- Support for modern PHP versions and extensions