AGENTS
August 7, 2026 · View on GitHub
Read root AGENTS.md first. Security: SECURITY.md. Wiring files: ../config/AGENTS.md.
Why Utils? Flight docs put app-specific classes under something like app/UTILS (not under config/). This folder holds those classes. Using Utils (not Config) avoids a case-only clash with app/config/ on Windows/macOS.
Classes
| Class | Role |
|---|---|
Config | Immutable-ish bag: get('a.b'), all(), isDebug(), env(), baseUrl(), mergeEnv() |
Env | Minimal .env loader → putenv / $_ENV (bootstrap only) |
DatabaseFactory | Build SimplePdo from Config (web + CLI) |
Nuances
- Only bootstrap / Env / mergeEnv / CLI entrypoints should touch
$_ENV. Controllers injectConfig. ENV_MAPis the allowlist of env → dotted config paths. Unmapped env vars are ignored on purpose (no magic dump of all env into config).- Adding a setting: (1) default in
config_sample.php, (2) optional env name in.env.example+ENV_MAP, (3) read viaConfig::get. mergeEnv: env wins when the variable is set and non-empty. Empty string does not override file defaults.isDebug()accepts bool or common string forms (true/false/1/0).- DatabaseFactory throws if driver empty/unsupported — commands should catch and print a clear CLI error.
- Keep these classes free of Flight facades and HTTP concerns.
Do not
- Turn
Configinto a service locator for random objects. - Parse
.envinside controllers “just once.” - Reintroduce
app/Config/next toapp/config/(Windows case-insensitive FS collision).