Php Wasm puts PHP right in the browser.
Php Wasm runs PHP through WebAssembly in browsers, Node.js, and Cloudflare Workers. In the browser, PHP can be invoked from Javascript or static HTML with full access to JS APIs and the DOM. It can also run in a service worker, where it mimics a CGI webserver like Apache or nginx. And yea, it can serve whole websites.
Standard PDO Database Connectors.
Php Wasm supports SQLite, PostgreSQL, and Cloudflare D1, all via PDO, so you can query your database just like you’ve always done it.
A Full Bridge To Javascript Code
The Vrzno extension allows PHP to gain access to any APIs available to Javascript. Objects, functions, and even classes can be imported from Javascript and used in PHP as if they were native code. That opens up things like DOM APIs, or anything else the browser exposes to Javascript. On the desktop, Node.js packages like NodeGTK can be used to build desktop applications in PHP.
You can see a simple demo of the Curvature framework being used to generate some dynamic html here, or a node-based version that allows PHP to access GTK here.
Field Tested.
Php Wasm is already powering cutting-edge frontend PHP applications like WordPress-Playground, Drupal-Playground, and PlayWithLaravel. You can also find it featured on 3v4l.org.
Fully Loaded with Batteries Included.
Php Wasm comes with support for many of the most commonly used PHP extensions, including LibXML, OpenSSL, Intl, ICU, GD, mbstring + oniguruma, and zlib. Most of them can be loaded dynamically as shared objects, or compiled statically if your use case requires it. View the whole list.
Extensions can even be loaded from a CDN like jsDelivr or unpkg, since they’re wrapped in JS modules. You can learn how to do all that and more in the docs.
Isomorphic PHP.
Write code that runs on the backend, the frontend, the edge and the service worker. You can even include classes directly from Packagist with a cloud-based autoloader.
And, of course, it’s Open Source.
Php Wasm is published 100% for free, dual licensed under the Apache License, Version 2.0 and the GNU General Public License, Version 2. This means Php Wasm is and always will be 100% free. Php Wasm is committed to maintaining the free and open nature of the web, and all the tools the project is based on.
Want to Reach Out?
If you’d like to get involved and contribute code or sponsorship, head over to the GitHub repo, and don’t hesitate to say hi on Discord!