Documentation · Chapter 06

Configure without
mixing it into code.

The same application should run on your computer, in tests, and on a server without changing its PHP classes.

No real secret is required: we configure reading-list with safe values.

≈ 70 min

The program stays the same; its context changes.

Imagine a recipe. Its steps are code. The kitchen address, pantry key, and oven temperature are configuration. Copying them into every step would make the recipe hard to move and dangerous to share.

Three families not to confuse

Code

Classes, routes, and views that describe behavior.

Configuration

Choices that vary by installation: URL, debug, database.

Data

User-created content stored in sessions or a database.

PHPAML's configuration chain

phpaml — zsh
phpaml.json       → choix partageables / shareable choices
.env               → valeurs locales et secrets / local values and secrets
runtime/config/
└── app.php         → résultat généré / generated result

PHPAML reads the manifest and environment, applies defaults, normalizes paths, then writes its internal configuration. The rest of the app receives one coherent result.

VOCABULARY

Words to remember

ManifestFile describing shareable choices.
EnvironmentValues belonging to a machine or server.
SecretPrivate value such as a password or key.

SUMMARY

What to remember

  • Code describes behavior; configuration describes context.
  • phpaml.json is shared with the project.
  • .env belongs to each installation.
  • runtime/config/app.php is generated.