7. Execution Process

Radar for PHP

7. Execution Process

The full execution process in Radar looks like this:

Boot -> Setup -> Run -> Middleware

Point by point:

  • A bootstrap phase to build a DI container with custom configuration;

  • The setup phase (this is where you define the URL routes with their action elements, add middleware callables, define custom Action/Routing/Exception/ Sending handlers), etc.

  • The run phase, which executes all middleware callables in turn.

The initial web/index.php installation queues four middleware decorators:

  • Relay\Middleware\SendingHandler to pass along the inbound request without modification, and send back the outbound response after all other middlware have processed it;

  • Relay\Middleware\ExceptionHandler as a final fallback to catch exceptions;

  • Radar\Adr\Handler\RoutingHandler to determine the Route based on the ServerRequest;

  • Radar\Adr\Handler\ActionHandler to use the Route for the action-domain-responder activity:

    • An Input callable is invoked to examine the incoming HTTP ServerRequest message and extract values to pass along to the core Domain callable.

    • A Domain callable is invoked using those values, and a Payload from the Domain is received in return.

    • A Responder callable is invoked with the Domain output; the Responder then builds the outgoing HTTP Response message.

You can prepend, append, or replace these handlers in web/index.php with your own middleware.