Skip to content

[Docs] how to use @php-wasm/compile-extension from a downstream repo - #3595

Merged
adamziel merged 4 commits into
trunkfrom
adamziel/doc-compile-ext
May 3, 2026
Merged

[Docs] how to use @php-wasm/compile-extension from a downstream repo#3595
adamziel merged 4 commits into
trunkfrom
adamziel/doc-compile-ext

Conversation

@adamziel

@adamziel adamziel commented May 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

The @php-wasm/compile-extension helper isn't on npm yet, so projects that want to build a PHP.wasm side module from their own repo (the wp_mysql_parser work in WordPress/sqlite-database-integration#395 was the trigger) have to pull it out of this monorepo. The path that worked in that PR is a sparse checkout of WordPress/wordpress-playground plus npm ci --ignore-scripts. This change writes that pattern down so the next person doesn't have to rediscover the package list.

While I was in there, two more things needed clearer docs:

  • The supported --php-versions matrix (7.4 and 8.08.5) is now stated where readers actually look, with an example invocation that builds the whole matrix.
  • Rust extensions built on ext-php-rs 0.15 can't include PHP 7.4 — the crate depends on PHP 8 Zend APIs and won't compile against PHP 7.4 headers. The helper itself still supports 7.4 for non-Rust extensions and for Rust extensions that bind Zend directly via bindgen. The note lives in the Rust-build-systems section so it shows up next to the rest of the Rust gotchas.

Edits land in three places that all describe the same toolkit:

  • packages/docs/site/docs/developers/06-apis/javascript-api/08-build-php-extensions.md
  • packages/docs/site/docs/developers/06-apis/javascript-api/09-php-extension-dependencies.md
  • packages/php-wasm/compile-extension/README.md

Docs only — no source or binary changes.

Test plan

  • npm run build:docs builds without warnings
  • Eyeball the rendered "Building PHP extensions" and "PHP extension dependencies" pages on the local docs server
@adamziel
adamziel requested review from a team, brandonpayton and Copilot May 3, 2026 20:02
@github-actions github-actions Bot added the [Type] Documentation Improvements or additions to documentation label May 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Documents how to use @php-wasm/compile-extension from a downstream repository (since it’s not published to npm yet), and clarifies PHP version support and Rust (ext-php-rs) constraints.

Changes:

  • Add downstream (sparse-checkout) GitHub Actions guidance for running the helper from another repo.
  • Clarify supported --php-versions matrix (PHP 7.4, 8.0–8.5) and provide a full-matrix example.
  • Document ext-php-rs 0.15 incompatibility with PHP 7.4 headers and the resulting matrix restriction.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
packages/php-wasm/compile-extension/README.md Adds downstream sparse-checkout instructions and documents PHP version + Rust support caveats.
packages/docs/site/docs/developers/06-apis/javascript-api/08-build-php-extensions.md Adds PHP version matrix guidance and downstream usage steps for CI.
packages/docs/site/docs/developers/06-apis/javascript-api/09-php-extension-dependencies.md Adds a dedicated section on ext-php-rs PHP version limitations with an example command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/php-wasm/compile-extension/README.md
Comment thread packages/php-wasm/compile-extension/README.md Outdated
Comment thread packages/php-wasm/compile-extension/README.md Outdated
Comment thread packages/php-wasm/compile-extension/README.md Outdated
Comment thread packages/php-wasm/compile-extension/README.md Outdated
adamziel added 4 commits May 4, 2026 00:27
The compile-extension helper isn't on npm yet, so external CI jobs need to
sparse-checkout WordPress/wordpress-playground to run it. Document the
sparse-checkout list, why packages/php-wasm/compile has to come along, and
the apt-mirror flake that justifies max-parallel: 1.

Also call out the supported PHP matrix (7.4, 8.0–8.5) and note that Rust
extensions built on ext-php-rs 0.15 can't include PHP 7.4 because the
crate depends on PHP 8 Zend APIs.
- Show how to actually invoke the CLI from a downstream sparse-checkout
  (npm ci --ignore-scripts skips the build, so the npx form does not work
  there; document the type-stripping invocation PR #395 used).
- Note that PHP 7.4 needs its own node-builds/7-4 entry in the
  sparse-checkout list.
- Reformat the YAML examples to conventional 2-space indentation under with:.
- Name the GitHub Actions field as strategy.max-parallel instead of bare
  max-parallel.
@php-wasm/compile-extension is published, so downstream repos can run the
helper through npx without a wordpress-playground checkout. The new "Running
in CI" section is a small GitHub Actions job that does just that. The
strategy.max-parallel: 1 note stays since it's about Docker on hosted
runners, not about the helper itself.
After #3596 the helper emits manifests in the PHPExtensionManifest shape:
artifacts use sourcePath instead of file, sha256 was removed because the
loader stopped verifying hashes, and there is a new --extra-files flag for
staging sidecar assets. The README on trunk already reflects this; bring
the public docs page in line and document --extra-files alongside the
matrix example.
@adamziel
adamziel force-pushed the adamziel/doc-compile-ext branch from a6d2f96 to 3b2d30f Compare May 3, 2026 22:30
@adamziel adamziel changed the title Docs: how to use @php-wasm/compile-extension from a downstream repo May 3, 2026
@adamziel
adamziel merged commit 6f7c10d into trunk May 3, 2026
49 of 50 checks passed
@adamziel
adamziel deleted the adamziel/doc-compile-ext branch May 3, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Documentation Improvements or additions to documentation

2 participants