Skip to content

Latest commit

 

History

History
78 lines (49 loc) · 1.33 KB

README.md

File metadata and controls

78 lines (49 loc) · 1.33 KB

Use php-wasm to send HTTP(s) requests from inside WASM

Instructions for this devcontainer

Tested with Node 20.12.1, Bun 1.1.8, Deno 1.43.3, php-wasm v0.0.8.

Preparation

  1. Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.

Installation

  1. cd into the folder of this example:
cd browser-and-node-php-wasm
  1. Install php-wasm:
yarn add php-wasm

Test with browser

  1. Run simple HTTP server to temporarily publish project to Web:
python3 -m http.server

Codespace will show you "Open in Browser" button. Just click that button or obtain web address from "Forwarded Ports" tab.

  1. As index.html and a 4.5M-sized wasm file are loaded into browser, refer to browser developer console to see the results.

Test with Node.js

  1. Run with Node:
node httpget.mjs

Test with Bun

  1. Install Bun:
curl -fsSL https://bun.sh/install | bash
  1. Run with Bun:
~/.bun/bin/bun httpget.mjs

Test with Deno

  1. Install Deno:
curl -fsSL https://deno.land/x/install/install.sh | sh
  1. Run with Deno:
~/.deno/bin/deno run --allow-read --allow-net httpget.mjs

Finish

Perform your own experiments if desired.