Skip to content

AOT: phpc deploy bundles binary, public/, assets/, and phpc.json into dist/ #609

@PurHur

Description

@PurHur

Problem

#585 ✅ added PHPC_DEPLOY_ROOT / phpc_deploy_path() so AOT binaries can include templates at runtime when sources are not beside the executable. #594 ✅ serves /assets/* from a manifest assets/ directory under phpc serve.

There is still no packaging CLI that produces a production-shaped tree contributors can copy behind nginx/CGI (#180, #445). Today authors hand-copy public/, assets/, and the binary.

Goal

phpc deploy examples/003-MiniWebApp -o dist/003-miniwebapp
# or: phpc build --project … && phpc deploy --from-build

Emit:

dist/003-miniwebapp/
  bin/app                 # AOT binary from phpc.json "binary"
  public/                 # copied docroot (index.php may be omitted if fully bundled)
  assets/                 # copied when manifest has "assets"
  templates/              # optional copy when not fully bundled into binary
  phpc.json
  README.deploy           # env vars: PHPC_DEPLOY_ROOT, QUERY_STRING, PHP_COMPILER_DEBUG

Scope

  • bin/phpc.php subcommand deploy (or bin/deploy.php wrapper)
  • Read manifest via lib/Web/ProjectManifest.php (entry, binary, public, assets)
  • Copy trees with safe path checks (no .. traversal)
  • Document PHPC_DEPLOY_ROOT=<dist> for template includes rewritten by SourceBundler (AOT: PHPC_DEPLOY_ROOT for runtime template includes in deployed binaries #585)
  • test/unit/PhpcDeployTest.php — temp project → dist layout assertions (no LLVM required for copy-only path)

Acceptance criteria

./phpc deploy examples/002-StaticWeb -o /tmp/static-dist
test -x /tmp/static-dist/bin/app -o -f /tmp/static-dist/phpc.json

When #568 lands, extend fixture to examples/003-MiniWebApp and assert assets/style.css + templates/layout.php exist in dist.

Harness (Docker):

docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
  ./phpc deploy examples/002-StaticWeb -o /tmp/static-dist

No GitHub Actions.

Dependencies

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions