HTTP Application Workflow
Table of Contents
Introduction
Opulence uses a single point of entry for all pages. In other words, all HTTP requests get redirected through index.php, which instantiates the application and handles the request. Here's a breakdown of the workflow of a typical Opulence HTTP application:
Workflow
- User requests http://www.example.com/users/23/profile
- Your virtual host redirects the request through http://www.example.com/index.php
- bootstrap/http/start.php is loaded, which instantiates an
Application
object - Various configs are read, and bootstrappers are registered
- Pre-start tasks are run
- Bootstrappers' bindings are registered by the bootstrapper
Dispatcher
- Bootstrappers are run by the bootstrapper
Dispatcher
- Bootstrappers' bindings are registered by the bootstrapper
- The application is started
- An HTTP
Kernel
is instantiated, which converts the HTTP request into a response- The path "/users/23/profile" is detected by the request
- All global middleware are run
- The
Router
finds a route that matches the request- The user Id 23 is extracted from the URL here
- The
Dispatcher
runs any middleware registered specifically to this route - The
Dispatcher
dispatches the request to theController
- The user Id is injected into the controller method
- The
Controller
processes data from the request, updates/retrieves any appropriate models, and creates aResponse
- The
Response
is sent back to the user - Post-start tasks are run
- Pre-shutdown tasks are run
- The application is shut down
- Post-shutdown tasks are run