Skip to content

[PHP] Add Blueprint PHP extension loading step#3568

Draft
adamziel wants to merge 1 commit intocodex/unified-php-extension-loadingfrom
codex/php-extension-blueprint-loading
Draft

[PHP] Add Blueprint PHP extension loading step#3568
adamziel wants to merge 1 commit intocodex/unified-php-extension-loadingfrom
codex/php-extension-blueprint-loading

Conversation

@adamziel
Copy link
Copy Markdown
Collaborator

@adamziel adamziel commented Apr 29, 2026

What it does

Adds a loadPHPExtension Blueprint step on top of the runtime extension loader from #3566. Blueprints can now load either a direct .so resource or a compile-extension manifest.json resource, plus optional sidecar files through extraFiles.

This is the middle PR in the stack: #3566 runtime loader → this Blueprint step → #3567 compiler tools.

Rationale

The runtime PR gives Playground a shared loadPHPExtension() API, but extenders also need a declarative Blueprint entry point. Keeping this in a stacked PR makes the runtime API reviewable on its own while preserving the same loading path for Blueprint users.

Implementation

The step resolves source as a normal Blueprint file resource, infers sourceFormat from .json vs .so, then calls @php-wasm/universal:

{
  "step": "loadPHPExtension",
  "source": {
    "resource": "url",
    "url": "https://example.com/extensions/example/manifest.json"
  },
  "sourceFormat": "manifest"
}

literal:directory is now recognized as a directory resource so extraFiles can carry data files or dependency assets. URL resources retain a non-enumerable sourceUrl so relative manifest artifacts can be resolved from the manifest URL.

Testing instructions

npx nx typecheck playground-blueprints
npx nx build:blueprint-schema playground-blueprints
cd packages/playground/blueprints
npx vitest run src/lib/steps/load-php-extension.spec.ts --config vite.config.ts
npx vitest run src/lib/v1/resources.spec.ts --config vite.config.ts -t "recognizes literal directory resources"

@adamziel adamziel force-pushed the codex/php-extension-blueprint-loading branch from 38515ca to cdbef2d Compare April 29, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant