Problem
Shipped examples stop at HTML pages (001-SimpleWeb, 002-StaticWeb). The north-star app (#67) needs a /api/status JSON route, but there is no small example that drives json_encode, http_response_code, and Content-Type: application/json through phpc lint / ExamplesCompileTest.
Goal
Add examples/004-ApiJson/example.php as a lint-first stub (like #246 for MiniWebApp):
header('Content-Type: application/json');
http_response_code(200);
echo json_encode(['ok' => true, 'service' => 'php-compiler']);
Start with phpc lint --json listing blockers; expand to VM smoke, then JIT/AOT when #61 / #252 close.
Scope
Acceptance criteria
Today (blockers expected):
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
./phpc lint examples/004-ApiJson/example.php
exits 0 with structured unsupported nodes OR exits 0 with clean lint once blockers close.
When #61 + #252 land:
./phpc run examples/004-ApiJson/example.php
prints valid JSON; curl via phpc serve returns application/json.
Dependencies
Links
Problem
Shipped examples stop at HTML pages (
001-SimpleWeb,002-StaticWeb). The north-star app (#67) needs a/api/statusJSON route, but there is no small example that drivesjson_encode,http_response_code, andContent-Type: application/jsonthroughphpc lint/ExamplesCompileTest.Goal
Add
examples/004-ApiJson/example.phpas a lint-first stub (like #246 for MiniWebApp):Start with
phpc lint --jsonlisting blockers; expand to VM smoke, then JIT/AOT when #61 / #252 close.Scope
examples/004-ApiJson/example.php+README.md(curl +phpc runrecipes)ExamplesCompileTestvia glob (automatic)test/real/cases/api_json_smoke.phptwhen VM builtins landAcceptance criteria
Today (blockers expected):
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \ ./phpc lint examples/004-ApiJson/example.phpexits 0 with structured unsupported nodes OR exits 0 with clean lint once blockers close.
When #61 + #252 land:
prints valid JSON;
curlviaphpc servereturnsapplication/json.Dependencies
json_encode/json_decodehttp_response_code()Links
examples/README.md, Docs: examples/README — phpc/vm/aot run matrix per example folder #262, Reference: MiniWebApp lint-first skeleton (examples/003-MiniWebApp) #246, 🗺️ ROADMAP: Compile a small PHP web application (living document) #78 ROADMAP