WordPress / WordPress/wordpress-playground

PHP WASM: Publish each PHP version as separate NPM package

Open
#862 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

[Feature] PHP.wasm [Type] Enhancement
Dominant language
JavaScript
Stars
2k
Forks
462
Avg merge
18h 44m
Merged PRs (30d)
33

Description

Just an idea, not sure if it's practical to implement and maintain.

Currently, the package @php-wasm/node is published to NPM as a single bundle with all supported PHP versions. That's around 93MB total.

9.8M    php_5_6.wasm
10M     php_7_0.wasm
11M     php_7_1.wasm
11M     php_7_2.wasm
11M     php_7_3.wasm
11M     php_7_4.wasm
9.8M    php_8_0.wasm
9.6M    php_8_1.wasm
9.9M    php_8_2.wasm

It could be convenient if each PHP version is published as its own package, so library users could import only what they need.

On the other hand, that might be an effort to maintain, unless it's automated (with GitHub Actions somehow, I suppose).


On this topic, I recently created a couple of server-side tools in Node.js using PHP WASM.

  • PHP Parser - Standalone library to parse PHP files using PHP WebAssembly

    I'm using this parser in the build script of a plugin documentation site with Docusaurus, to parse the plugin codebase, extract Docblock comments and associated class names, functions, etc., and generate Markdown pages.

  • PHP Beautify - Lint and format source files using PHP Code Sniffer and WordPress Code Standards running on PHP WebAssembly

    This tool is being used as part of an in-company build setup to standardize code formatting.

A nice advantage I'm appreciating about PHP WASM is how portable it is, so that tools like the above don't have to depend on PHP (or Docker) being installed on the user's system.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how the @php-wasm/node package currently bundles and publishes the PHP WASM files. Investigate whether the proposed per-version packages can be maintained through GitHub Actions, then define what separate packages, imports, and publishing behavior would count as complete; the issue names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, php, wasm
Domain
build-system, release, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.