PAD in the browser
PAD also runs on PHP compiled to WebAssembly, inside a browser tab, with no PAD server at all. php wasm/build.php bundles the engine into one file, and the page wasm/ loads PHP into the tab, writes the engine into its memory and renders the template you type with the JSON data beside it - the example below, on this server, is the page's sample:
|
PHP fragments/pad_in_the_browser_1.php |
HTML fragments/pad_in_the_browser_1.pad |
Result |
|---|---|---|
|
|
Fruit
|
- PHP comes from the
@php-wasmpackages of WordPress Playground, loaded from jsDelivr: about 20 MB, once. - The template can only reach the browser tab it runs in, so there is no PHP function list to keep; there is no database either, and the sequence subsystem's large tables are left out of the bundle.
- It is experimental:
wasm/README.mdsays what was verified - the engine on the PHP 8.3, 8.4 and 8.5 WebAssembly builds, the page in Chrome - and what was not.
A whole application runs in the browser the same way, its SQLite database kept there between visits, opened from the disk or installed from an https host: Offline applications.