Repository navigation
[Website] Add PHP next builds - #3692
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for PHP next (dev-branch) builds in the web Playground runtime by publishing large nightly artifacts to a separate branch and wiring website/runtime/UI/docs to consume them without committing binaries to trunk.
Changes:
- Introduces
nextas a first-class PHP version across runtime APIs, blueprints schema/validator, and website UIs. - Adds tooling + CI to build and publish
php-nextweb artifacts and to sync them into the gitignored website public directory for deploys/dev. - Adds/updates static pages and docs to expose and document
?php=next, including a PHP 8.6 preview page.
Reviewed changes
Copilot reviewed 38 out of 39 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/playground/website/vite.config.ts | Avoids proxying php-next assets and adds a dev-only shim for importing the local client bundle. |
| packages/playground/website/src/components/site-manager/site-settings-form/unconnected-site-settings-form.tsx | Adds next to the PHP version dropdown and avoids resetting when next is selected. |
| packages/playground/website/public/php-playground.html | Adds next to the static PHP Playground UI, supports query params, and imports the client differently in dev. |
| packages/playground/website/public/php-code-snippet.js | Dedents embedded PHP code before execution/display. |
| packages/playground/website/public/php-8-6.html | Adds a new demo page showcasing PHP-next (8.6-dev) runnable snippets. |
| packages/playground/website/project.json | Syncs php-next assets before dev server start and exposes a dedicated sync target. |
| packages/playground/website/demos/index.html | Links to the new PHP 8.6 feature preview demo page. |
| packages/playground/website-extras/src/php-playground/url-state.ts | Adds support for php/wp query params when no hash state exists. |
| packages/playground/website-extras/src/php-playground/store.ts | Uses a curated PHP version list for the PHP Playground UI (including next). |
| packages/playground/website-extras/src/php-playground/php-versions.ts | Defines PHP Playground version ordering and label mapping for next. |
| packages/playground/website-extras/src/php-playground/components/PlaygroundManager.tsx | Passes preferredVersions.php into the Blueprint during boot. |
| packages/playground/website-extras/src/php-playground/components/Controls.tsx | Displays a friendly label for next in the PHP version select. |
| packages/playground/client/src/index.ts | Re-exports PHPNextVersion for consumers. |
| packages/playground/cli/src/run-cli.ts | Filters next out of CLI --php choices. |
| packages/playground/blueprints/public/blueprint-schema.json | Extends schema to accept php: "next" as an AllPHPVersion. |
| packages/playground/blueprints/public/blueprint-schema-validator.js | Updates generated validator to accept next in AllPHPVersion. |
| packages/php-wasm/web/src/lib/load-runtime.ts | Routes async-mode into loader selection and widens extension handling to AllPHPVersion. |
| packages/php-wasm/web/src/lib/get-php-next-module.ts | Adds dynamic import logic for /php-next/index.js artifacts. |
| packages/php-wasm/web/src/lib/get-php-loader-module.ts | Adds next handling and async-mode selection. |
| packages/php-wasm/web/src/lib/extensions/load-extensions.ts | Explicitly disallows extensions for legacy + next builds. |
| packages/php-wasm/universal/src/lib/supported-php-versions.ts | Introduces PHPNextVersion, type guard, and includes it in AllPHPVersions. |
| packages/php-wasm/universal/src/lib/index.ts | Exports PHPNextVersion and isPHPNextVersion. |
| packages/php-wasm/node/src/lib/get-php-loader-module.ts | Throws a clear error for next in the Node runtime. |
| packages/php-wasm/compile/sync-php-next-assets.mjs | Adds a script to fetch the php-next-builds artifact branch into the gitignored public directory. |
| packages/php-wasm/compile/php/php8.6.patch | Adds php-src patching needed for 8.6-dev builds. |
| packages/php-wasm/compile/php/Dockerfile | Adds support for cloning php-src by ref and patch selection fallback for unknown minors. |
| packages/php-wasm/compile/build.js | Adds PHP_REF plumbing to Docker builds for dev-branch builds. |
| packages/php-wasm/compile/build-php-next-web.mjs | Adds a builder that compiles php-src default branch into php-next web artifacts + loader index/manifest. |
| packages/docs/site/docs/main/quick-start-guide.md | Documents ?php=next usage in the quick start. |
| packages/docs/site/docs/developers/23-architecture/03-wasm-php-compiling.md | Documents the php-next-builds workflow and local sync/build commands. |
| packages/docs/site/docs/developers/06-apis/query-api/01-index.md | Documents next as a supported php Query API value (web-only). |
| packages/docs/site/docs/blueprints/03-data-format.md | Documents Blueprint preferredVersions.php = "next" (web-only). |
| package.json | Adds recompile:php:web:next and sync:php-next scripts. |
| AGENTS.md | Documents the new next build and sync scripts. |
| .prettierignore | Ignores generated php-next assets directory. |
| .github/workflows/refresh-php-next.yml | Adds scheduled workflow to build + publish php-next-builds artifacts and trigger website deploy. |
| .github/workflows/deploy-website.yml | Syncs php-next artifacts before building/deploying the website. |
| .eslintignore | Ignores generated php-next assets directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
|
Let's try it! |
4 of 5 tasks
mho22
added a commit
that referenced
this pull request
Sep 30, 2026
## Motivation for the change, related issues
Every `@php-wasm/web` loader declares `dependencyFilename` with a bare
import of a `.wasm` file, which relies on the bundler treating it as an
asset. Vite 8 implements the WASM ESM Integration proposal and resolves
it as a module instead, so the build fails with `[MISSING_EXPORT]
"default" is not exported`. `assetsInclude` does not apply, so there is
no opt-out. This PR switches the web loaders to `new
URL('./php_X_Y.wasm', import.meta.url).href`, the form #3692 already
ships for the PHP next loaders.
## Implementation details
- **Loaders:** `Dockerfile` and `Dockerfile-5-2` emit the new line for
web builds; the Node branch keeps `path.join()`. The 16 committed
loaders get the same rewrite, so the published packages need no
recompile.
- **Breaking:** The loaders now use `import.meta`, so bundling
`@php-wasm/web` to `cjs` or `iife` throws `TypeError: Invalid URL` at
load. The published packages are unaffected — `index.cjs` keeps a native
dynamic `import()`. webpack 5 users must drop any `.wasm` `file-loader`
rule.
- **Vite configs:** The dead `wasm` entry goes from `viteIgnoreImports`
in six configs. `playground-website` and `playground-personal-wp` mark
`/^@php-wasm\/web-\d+-\d+$/` external, since neither calls
`loadWebRuntime()`.
- **Bundler tests:** Vite lib mode always inlines a `new URL()` asset as
base64, because `shouldInline()` returns early on `config.build.lib`.
Externalizing the version packages takes the web bundle from 617 MB to
817 KB.
- **Guards:** `loader-wasm-url.spec.ts` asserts all 16 loaders declare
`new URL()`; `run-bundler-tests` fails on a base64 WASM data URI. The
dead esbuild `loader` key goes too, leaving built artifacts
byte-identical.
## Testing Instructions (or ideally a Blueprint)
- [x] `npx nx test php-wasm-web` — 76 pass, 16 of them in
`loader-wasm-url.spec.ts`
- [x] Built a committed loader with Vite 8.3.1 — the bare import fails,
`new URL()` builds
- [x] Booted 8 PHP versions × jspi/asyncify on the dev server (16/16, no
console errors)
- [x] `playground-website` and `playground-personal-wp` build with 0
`.wasm` files, down from 16
- [ ] Confirm no consumer needs a `cjs` or `iife` bundle of the web
runtime
See: vitejs/vite#21779
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved WebAssembly loading across supported PHP versions by
resolving binaries relative to their modules.
* Updated web build configurations to keep PHP binaries from being
embedded as large base64 data.
* **Documentation**
* Updated bundler setup guidance with asset-serving requirements and
configuration notes.
* **Tests**
* Added checks for WebAssembly URL resolution and for unexpectedly
embedded binaries in web bundles.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Adds PHP
nextbuilds for the Playground web runtime without committing the binaries totrunk.php-next-buildsbranch.packages/playground/website/public/php-next/assets for website deploys and local dev.php=nextin the Query API and BlueprintpreferredVersions.php.php-8-6.html.?php=nextdirectly, displayed asNext (development).Demo: https://playground.wordpress.net/php-8-6.html
PHP Playground: https://playground.wordpress.net/php-playground.html?php=next
Rationale
nextis release-cycle neutral. It can point at PHP8.6.0-devtoday and PHP8.7.0-devlater without teaching Playground about each upcoming version in UI code.The binaries are large and change nightly. Publishing them to
php-next-buildskeeps daily binary churn out oftrunkwhile still making the artifacts available toplayground.wordpress.netand local dev servers.This PR intentionally ships web main modules only. PHP extensions are disabled for
nextuntil we also publish matching ABI side modules.Implementation
Key pieces:
@php-wasm/universaldefinesPHPNextVersion = "next"and includes it inAllPHPVersion.@php-wasm/webdetectsversion === "next"and dynamically imports/php-next/index.js.build-php-next-web.mjscompiles php-src's default development branch and writes theindex.jsloader plusjspi/asyncifyartifacts.sync-php-next-assets.mjsfetchesphp-next-buildsinto the gitignored website public directory.deploy-website.ymlsyncs those assets before deployingplayground.wordpress.net;npm run devsyncs them for local website dev.?php=next, showsNext (development), and passesnextto the runtime. There is no8.6mapping to update next cycle./website-server/client/index.js, so localphp-playground.htmlimports the local client instead of the deployed one.CLI support is a follow-up PR. The next PR can reuse
php-next-builds, add Node.jsnextartifacts, and teach Playground CLI how to resolve--php=next. Until then, the CLI filtersnextout of--phpchoices and the Node runtime returns an explicit “web runtime only” error if called directly.Testing instructions
Manual verification performed:
nextartifact:http://127.0.0.1:5400/website-server/?php=next&wp=latestand confirmed WordPress booted with PHP8.6.0-dev./website-server/php-next/index.js/website-server/php-next/jspi/php_8_6.js/website-server/php-next/jspi/8_6_0-dev/php_8_6.wasmhttp://127.0.0.1:5400/website-server/php-playground.html?php=nextand confirmed:Next (development).Hello from PHP 8.6.0-dev.Checks run: