Skip to content

Internals Router Events RouteEnterEvent

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

router\events\RouteEnterEvent

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/router/events/RouteEnterEvent.php · Snapshot 8411f4287706.

Routing separates definition, HTTP request snapshot, matching, method policy, execution and error responses. Collaborators can be replaced through constructor injection.

Imports and dependencies

use controller\Controller;
use event\interfaces\IEvent;

RouteEnterEvent

Declaration and architectural role

class RouteEnterEvent implements IEvent

Source description (behavioral corrections are recorded in Known discrepancies):

Class RouteEnterEvent

Represents an event that is triggered when a route is entered in the router. This event contains information about the route's path, action, and the controller handling the request.

Constants, enum cases, traits and properties

Declarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.

Member Declaration Purpose or source contract
$path public string $path; @var string The path of the route that has been entered.
$action public string $action; @var string The action associated with the route.
$controller public Controller $controller; @var string The name of the controller handling the route.
Constructor-promoted public function __construct(string $path Initialized from the constructor argument; default expression is evaluated when the argument is omitted.

Method index

Method Signature
__construct public function __construct(string $path, string $action, Controller $controller)
getName public function getName(): string
bundle public function bundle(): array

__construct

Source line 39

public function __construct(string $path, string $action, Controller $controller)

Parameters

Parameter Type, modifiers and default Purpose
$path string $path The path of the route.
$action string $action The action associated with the route.
$controller Controller $controller Controller that handles the route.

RouteEnterEvent constructor.

@param string $path The path of the route. @param string $action The action associated with the route. @param string $controller Controller that handles the route.

State writes: $this->path, $this->action, $this->controller.

Implementation, validation guards and interaction order
/**
     * RouteEnterEvent constructor.
     *
     * @param string $path The path of the route.
     * @param string $action The action associated with the route.
     * @param string $controller Controller that handles the route.
     */
    public function __construct(string $path, string $action, Controller $controller)
    {
        $this->path = $path;
        $this->action = $action;
        $this->controller = $controller;
    }

getName

Source line 46

public function getName(): string

Return expressions (including local callbacks): 'router.enter'.

Implementation, validation guards and interaction order
public function getName(): string
    {
        return 'router.enter';
    }

bundle

Source line 51

public function bundle(): array

Return expressions (including local callbacks): ["path" => $this->path, "action" => $this->action, "controller" => $this->controller].

Implementation, validation guards and interaction order
public function bundle(): array
    {
        return ["path" => $this->path, "action" => $this->action, "controller" => $this->controller];
    }

Related types

Clone this wiki locally