DOF 的生命周期分为两种:Web 和 CLI。
Web
┌─────────────────────┐ ┌───────────────┐
│ DOF Web Entry │ │ Web Server │ ┌──────────────────┐
│ │◀──Proxy──│ │◀───Start───│ HTTP Client │◀─────End──────┐
│ (web/index.php) │ │(Nginx/Apache) │ └──────────────────┘ │
└──────────┬──────────┘ └───────────────┘ │
│ │
Boot │
│ │
▼ │
.─────────────────. .───────────────. │
( DOF Web Kernel ) ───1. Register kernel callbacks───▶( DOF core Kernel ) │
`────────┬────────' 2. Boot DOF core kernel `───────┬───────' │
│ │ │
3. Handle │ │
│ ▼ │
▼ ┌─────────────────────────────────────────────────┐ │
┌────────────────────────────────┐ │- Top-level namespace aliasing │ │
│ Request Preflight │ │ │ │
├───────────────┬────────────────┤ │- Register shutdown callbacks │ │
│ │ │ │ │ │
│ ▼ │ │- Setup PHP exception/error handler │ │
├────────────────────────────────┤ │ │ │
│ Port Routing │ │- Init and load configurations │ │
├───────────────┬────────────────┤ │ │ │
│ │ │ │- Managers load their classes and relationships │ │
│ ▼ │ └─────────────────────────────────────────────────┘ │
├────────────────────────────────┤ │
│ Request PipingIn │ │
├───────────────┬────────────────┤ │
│ │ │ │
│ ▼ │ │
├────────────────────────────────┤ │
│ Request WrapIn Validate │ │
├───────────────┬────────────────┤ │
│ │ │ │
│ ▼ │ │
├────────────────────────────────┤ │
│ Build Port Parameters │ │
├───────────────┬────────────────┤ │
│ │ │ │
│ ▼ │ │
├────────────────────────────────┤ │
│ Execute Port Method │ │
├───────────────┬────────────────┤ │
│ │ │ │
│ ▼ │ │
├────────────────────────────────┤ │
│ PipingOut Port Result │ │
├───────────────┬────────────────┤ │
│ │ │ │
│ ▼ │ │
├────────────────────────────────┤ │
│ Packing Response Result │ │
├───────────────┬────────────────┤ │
│ │ │ │
│ ▼ │ │
├────────────────────────────────┤ │
│ Port Logging AOP │ │
├───────────────┬────────────────┤ │
│ │ │ │
│ ▼ │ DOF PHP Web Application Lifecycle. │
├────────────────────────────────┤ │
│ Send Response ├────────────────────────────────────────────────────────────────────┘
└────────────────────────────────┘
CLI
┌─────────────────────┐ ┌───────────────────┐
│ DOF CLI Entry │ │ │
│ │◀────Start───│ CLI User/Scripts │ ◀───End────────────────────────────────┐
│ (dof) │ │ │ │
└──────────┬──────────┘ └───────────────────┘ │
│ │
│ │
Boot │
│ │
▼ │
.─────────────────. .───────────────. │
( DOF CLI Kernel ) ───1. Register kernel callbacks───▶( DOF core Kernel ) │
`────────┬────────' 2. Boot DOF core kernel `───────┬───────' │
│ │ │
┌──────────3. Handle─────────────┐ │ │
│ │ │ ▼ │
│ ▼ │ ┌─────────────────────────────────────────────────┐ │
├────────────────────────────────┤ │- Top-level namespace aliasing │ │
│ Build CLI Arguments │ │ │ │
├──────────────┬─────────────────┤ │- Register shutdown callbacks │ │
│ │ │ │ │ │
│ ▼ │ │- Setup PHP exception/error handler │ │
├────────────────────────────────┤ │ │ │
│ CMD Routing │ │- Init and load configurations │ │
├──────────────┬─────────────────┤ │ │ │
│ │ │ │- Managers load their classes and relationships │ │
│ ▼ │ │ │ │
├────────────────────────────────┤ └─────────────────────────────────────────────────┘ │
│ Execute Command Method │ │
├──────────────┬─────────────────┤ │
│ │ │ │
│ ▼ │ │
├────────────────────────────────┤ │
│ Console Output │ │
└──────────────┬─────────────────┘ │
│ DOF PHP CLI Application Lifecycle. │
│ │
└─────────────────────────────────────────────────────────────────────────────────────┘