Documentation · Chapter 02

One platform,
four structures.

PHPAML keeps useful principles, then removes folders with no role in the selected project type.

Classic application

It receives an HTTP request, uses routes and controllers, then generally renders a PHP view on the server.

phpaml — zsh
src/controllers/
src/models/
src/middleware/
src/views/
routes/WebApp.php
public/index.php

AML View

It keeps the PHPAML server, while declarative pages and components live under src/views. Engine then handles compiled frontend interactions.

phpaml — zsh
src/views/pages/
src/views/components/
src/views/layouts/
src/views/stylesheets/
routes/WebApp.php

API

It uses HTTP, routes, controllers, and data, but has no view layer. Its final representation is generally JSON.

phpaml — zsh
src/controllers/
src/requests/
src/resources/
src/repositories/
src/routes/
public/index.php

Console

It has no browser, HTTP request, or route. Program::main() receives terminal arguments and returns an exit code.

phpaml — zsh
src/Program.php
src/
tests/
phpaml.json

SUMMARY

What to remember

  • Classic renders pages on the server.
  • View adds a declarative reactive interface.
  • API responds without views, generally as JSON.
  • Console runs PHP without an HTTP server.