https://github.com/veewee/ext-wasm
Run webassembly from PHP
https://github.com/veewee/ext-wasm
extension php wasm wasmer webassembly
Last synced: about 1 year ago
JSON representation
Run webassembly from PHP
- Host: GitHub
- URL: https://github.com/veewee/ext-wasm
- Owner: veewee
- Created: 2023-04-06T17:27:40.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-29T13:42:29.000Z (over 2 years ago)
- Last Synced: 2025-03-28T01:02:58.174Z (over 1 year ago)
- Topics: extension, php, wasm, wasmer, webassembly
- Language: PHP
- Homepage:
- Size: 705 KB
- Stars: 16
- Watchers: 3
- Forks: 1
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WASM Extension for PHP
:exclamation::exclamation::exclamation: EXPERIMENTAL :exclamation::exclamation::exclamation:
## Installation
**Prerequisites:**
* rust toolchain
* php >= 8.0 (phpdev, php-cli, php-config)
* clang
```sh
make install
```
## Usage
```php
$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());
```
```bash
php examples/global.php
```
Check out the [examples](examples) folder for more examples.
## Stubs
```
make stubs
```
## Roadmap
[You can find a more detailed roadmap here.](https://github.com/users/veewee/projects/1)
Feel free to give me some additional keyboards! :)