mini\Dispatcher\HttpDispatcher::dispatch() Method

public

Signature

public function dispatch(): void

Returns

void

Documentation

Dispatch the current HTTP request

Complete HTTP request lifecycle:

  1. Register ServerRequest as Transient service
  2. Create PSR-7 ServerRequest from PHP request globals
  3. Set as current request
  4. Replace $_GET, $_POST, $_COOKIE with proxies (fiber-safe)
  5. Declare Ready phase (locks down service registration)
  6. Add request replacement callback for Router
  7. Build middleware chain and get RequestHandlerInterface (Router)
  8. Process request through middleware chain → router → handlers
  9. Catch exceptions and convert to responses
  10. Emit response to browser

Source

src/Dispatcher/HttpDispatcher.php:175-254