Documentation · Chapter 02

Read the structure
like a map.

Folders do not share the same lifetime or exposure. Distinguishing them prevents security and maintenance mistakes.

Three zones not to confuse.

PUBLICpublic/

The only Web-exposed root: index.php, public images, and static files.

YOUR CODEsrc/ · routes/

Controllers, models, views, components, services, and route declarations.

REBUILDABLEruntime/

Installed framework, dependencies, cache, logs, and runtime storage.

The manifest connects the project to AML.

phpaml.json lets AML recognize the project root, structure, and compatible versions. When you run aml serve from a subfolder, AML walks upward to this manifest.

phpaml — zsh
project/
├── phpaml.json
├── public/
│   └── index.php
├── routes/
│   └── WebApp.php
├── src/
│   ├── controllers/
│   ├── models/
│   ├── middleware/
│   └── views/
└── runtime/

Where should a new file go?

An image available by URLpublic/
A URL ruleroutes/
An HTTP actionsrc/controllers/
A business rule or data objectsrc/models/
A PHP interfacesrc/views/
An installed dependencyruntime/

CHECK YOUR UNDERSTANDING

Why should .env and src/ never be placed under public/?

Show the answer

Because public/ is exposed to the Web server. Secrets and internal code must remain outside that root.

SUMMARY

What to remember

  • public/ is the only Web root.
  • src/ and routes/ contain your application.
  • runtime/ can be rebuilt.
  • phpaml.json identifies and describes the project.