Documentation · Chapter 03

Understand the files
without getting lost.

You do not need to know the whole project. Start with the files you will actually edit.

You will change one element at a time, in an exact file, then verify the result.

The project map

phpaml — zsh
reading-list/
├── phpaml.json
├── composer.json
├── .env.example
├── public/
│   └── index.php
├── src/
│   ├── controllers/
│   ├── models/
│   ├── routes/WebApp.php
│   ├── services/
│   └── views/
├── tests/
└── runtime/

The four essential areas

public/

Public website entry and files the browser can request directly.

src/

Your application: this is where you work most of the time.

tests/

Automated checks preventing old behavior from breaking.

runtime/

Installed, rebuildable environment. Do not store your logic there.

Files you will edit in this chapter

src/routes/WebApp.phpdeclares addresses
src/controllers/AboutController.phpprepares the About page
src/controllers/BookController.phpprepares the book list
src/views/about.phpdisplays the About page
src/views/books.phpdisplays the books

What root files do

phpaml.json is the project's shared identity card. composer.json describes PHP libraries and autoloading. .env.example documents expected local settings without real secrets.

Do not edit runtime to fix your application

runtime can be regenerated. Application logic placed there may disappear after a reinstall or update.

YOUR TURN

Where would you place a new /contact address, its preparation code, and its HTML?

Show a hint

Route in src/routes, controller in src/controllers, view in src/views.