PHPackages                             kambo/webassembly - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kambo/webassembly

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kambo/webassembly
=================

Run web assembly in PHP

v0.1.0-alpha.1(1y ago)15MITCPHP ^8.1

Since Jan 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kambo-1st/webassembly)[ Packagist](https://packagist.org/packages/kambo/webassembly)[ Docs](https://github.com/kambo/webassembly)[ RSS](/packages/kambo-webassembly/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

PHP WebAssembly Library
=======================

[](#php-webassembly-library)

An quick POC (done in ~3 hours) for running WebAssembly modules using [Wasmer](https://wasmer.io/).

[![Latest Version on Packagist](https://camo.githubusercontent.com/99c22999ce008f9aeea0b03d94daf73a15e8e9867cc7e2bc691731a763586917/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b616d626f2f776562617373656d626c792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kambo/webassembly)[![Tests](https://camo.githubusercontent.com/f3f0f323cc5a453111bbebb365ea63b5a270ab5975cf183588ffc8803de2f3d9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b616d626f2d3173742f776562617373656d626c792f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/kambo-1st/webassembly/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/9c5b15aa56c11dac0073935b5507a1461171ac636473109a2ee30296f55d3c99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b616d626f2f776562617373656d626c792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kambo/webassembly)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require kambo/webassembly
```

Usage
-----

[](#usage)

Please see the [examples](examples) directory for usage examples.

```
$engine = new Kambo\WebAssembly\Engine();
$store = new Kambo\WebAssembly\Store($engine);

// Example WAT (WebAssembly Text) code
$wat = '(module
    (func $sum (param i32 i32) (result i32)
        local.get 0
        local.get 1
        i32.add)
    (export "sum" (func $sum)))';

$wasmBytes = WasmerFFI::watToWasm($wat);
$module = new Module($store, $wasmBytes);
$instance = new Instance($store, $module);

$args = Collection::from([10, 32], Value::KIND_I32);
$result = $instance->callFunction('sum', $args);
echo $result[0]->asI32(); // Outputs: 42
```

Current limitations
-------------------

[](#current-limitations)

- 🔧 Needs FFI extension to be enabled.
- ⚠️ Just a POC, can segfault at any moment.
- 🧹 It's probably leaking memory.
- 📦 Wasmer runtime is bundled with the library - not a good idea for production.
- ⚡ Limited support for some WebAssembly features.
- 🍎 Does not support Mac OS (I forget password to my Mac ).

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance41

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

491d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1073586?v=4)[Øystein Kambo Tangerås](/maintainers/kambo)[@kambo](https://github.com/kambo)

---

Top Contributors

[![kambo-1st](https://avatars.githubusercontent.com/u/6493048?v=4)](https://github.com/kambo-1st "kambo-1st (1 commits)")

---

Tags

ffiwebassemblywasmer

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/kambo-webassembly/health.svg)

```
[![Health](https://phpackages.com/badges/kambo-webassembly/health.svg)](https://phpackages.com/packages/kambo-webassembly)
```

###  Alternatives

[ffi/location

PHP library for determining the physical location of binaries

1339.8k7](/packages/ffi-location)[ffi/var-dumper

List of symfony/var-dumper casters with FFI support

2010.7k4](/packages/ffi-var-dumper)[serafim/ffi-sdl

SDL FFI bindings for the PHP language

314.6k3](/packages/serafim-ffi-sdl)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
