Skip to content

Internals Controller Interfaces IController

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

controller\interfaces\IController

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/controller/interfaces/IController.php · Snapshot 8411f4287706.

Controllers extend View and receive package context, paths and the dispatcher from their runtime or object factory. Route execution selects an action method.

Imports and dependencies

use redirect\Redirect;
use response\Response;
use view\View;

IController

Declaration and architectural role

interface IController

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

Interface IController

This interface defines the contract for controller classes in the application. It outlines the required methods that any implementing controller must provide, including methods for setting paths and handling requests.

Constants, enum cases, traits and properties

No own constants, enum cases, traits or property declarations. Inherited members are documented on the parent reference page.

Method index

Method Signature
setRootPath public function setRootPath(string $rootDirPath): void
setViewPath public function setViewPath(string $viewDirPath): void
index public function index(array|string $params): View|Redirect|Response

setRootPath

Source line 29

public function setRootPath(string $rootDirPath): void;

Parameters

Parameter Type, modifiers and default Purpose
$rootDirPath string $rootDirPath The root directory path to set.

Sets the root directory path for the controller.

This method allows the implementing controller to define the root directory path, which can be used to locate resources relative to this path.

@param string $rootDirPath The root directory path to set. @return void

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

setViewPath

Source line 41

public function setViewPath(string $viewDirPath): void;

Parameters

Parameter Type, modifiers and default Purpose
$viewDirPath string $viewDirPath The path to the view directory to set.

Sets the view directory path for the controller.

This method enables the implementing controller to specify the path to the view directory, which is used to locate the views associated with the controller's actions.

@param string $viewDirPath The path to the view directory to set. @return void

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

index

Source line 56

public function index(array|string $params): View|Redirect|Response;

Parameters

Parameter Type, modifiers and default Purpose
$params array|string $params The parameters for the index action, which

Handles the index action of the controller.

This method is responsible for processing the index action, which typically serves as the default action for a controller. It accepts parameters and returns either a View object or a Redirect object based on the action's outcome.

@param array|string $params The parameters for the index action, which may be an array or a string. @return View|Redirect Returns a View object for rendering a view, or a Redirect object for redirecting to another location.

Contract only: implementations supply the behavior. Parameter and return types are enforced by PHP; caller and implementation constraints follow the subsystem overview.

Related types

Clone this wiki locally