Skip to content

Examples: Migrate 003 + init-miniwebapp phpc.json to PSR-4 autoload (post-#1803) #1856

@PurHur

Description

@PurHur

Problem

003-MiniWebApp and templates/init-miniwebapp/phpc.json hand-maintain includes[]:

"includes": ["src/Router.php", "config.php"]

This works today (#752 ✅ link) but breaks down for larger apps and self-host bundles (#1492) where class graphs grow. #1803 adds static PSR-4 class discovery for phpc build --project; #1762 tracks dynamic require $path.

Goal

After #1803 lands on master:

  1. Replace includes[] with:
"autoload": { "psr-4": { "App\\": "src/" } }
  1. Namespace Router as App\Router (or keep global class with empty prefix — pick one, document in docs/phpc-json.md)
  2. Update public/index.php require / use lines
  3. Keep script/check-init-miniwebapp-parity.sh green (DevEx: Keep phpc init --profile miniwebapp template in sync with examples/003-MiniWebApp #695)
  4. Regenerate capability matrix if web rows change

Scope

  • examples/003-MiniWebApp/phpc.json + src/Router.php namespace
  • templates/init-miniwebapp/ mirror
  • test/unit/PhpcInitMiniWebAppTest.php / parity script
  • examples/README.md phpc.json section (one paragraph)
  • VM + AOT smokes: make web-smoke, MiniWebAppAotExecuteTest, make examples-aot-smoke

Acceptance criteria

./phpc lint --all examples/003-MiniWebApp
./phpc build --project examples/003-MiniWebApp
./script/ci-local.sh --filter MiniWebAppAotExecuteTest
./script/check-init-miniwebapp-parity.sh
make examples-aot-smoke   # 003 slice when LLVM ready

Docker:

docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
  ./script/ci-local.sh --filter MiniWebAppAotExecuteTest

Dependencies

Out of scope

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