Boot Sequence
Application::boot() runs once per process: on every request under PHP-FPM, and once at startup under Swoole. run(), runSwoole() and runWorker() call it for you. These steps execute in order:
-
Load
.env.vlucas/phpdotenvloads environment variables from the base path, without overwriting variables that are already set. A missing.envfile is not an error. Then the real environment (from Docker, systemd, your shell…) is copied into$_ENV, so a real variable always wins over.env.APP_BASE_PATHis set to the base path. -
Create the container. A fresh
Containeris created, andRouterand the OpenAPIGeneratorare registered as singletons. -
Register bridge providers. Antares reads
vendor/composer/installed.jsonand registers every provider listed underextra.antares.providersby an installed package (Monolog, Eloquent, …). -
Register your service providers. Each class passed to
->providers([...])is created and itsregister()method is called. Because this happens after step 3, your bindings replace a bridge’s. -
Register routes, or load them from the cache. With
APP_ENV=productionand a cache whose fingerprint still matches, routes are loaded fromstorage/cache/routes.phpand route providers are skipped. Otherwise each route provider’sregister()is called, the OpenAPI controller (/openapi.json,/docs) is added unless the docs are turned off, and in production the result is written to the cache. -
Create the Dispatcher and ErrorHandler. Middleware is not created here: the pipeline creates it for each request.
Cache Fingerprint
Section titled “Cache Fingerprint”The route cache fingerprint is computed from:
composer.lock.env- All files under
app/
If any of these change, the fingerprint changes and the cache is rebuilt on the next boot. Changes made anywhere else (for example a real environment variable, or routes loaded from a config/ file) are not detected; run php vendor/bin/antares cache:clear after those.