Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 998 Bytes

README.md

File metadata and controls

54 lines (37 loc) · 998 Bytes

WASM Extension for PHP

❗❗❗ EXPERIMENTAL ❗❗❗

Installation

Prerequisites:

  • rust toolchain
  • php >= 8.0 (phpdev, php-cli, php-config)
  • clang
make install

Usage

$instance = Wasm\InstanceBuilder::fromWat(
    <<<'EOWAT'
    (module
      (global $some (export "some") (mut i32) (i32.const 0))
      (func (export "get_some") (result i32) (global.get $some))
      (func (export "set_some") (param i32) (global.set $some (local.get 0))))
    EOWAT
)->build();

var_dump($instance->some);
$instance->some = 1;
var_dump($instance->some);
var_dump($instance->set_some(21));
var_dump($instance->get_some());
php examples/global.php

Check out the examples folder for more examples.

Stubs

make stubs

Roadmap

You can find a more detailed roadmap here. Feel free to give me some additional keyboards! :)