Repository navigation
Internals 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.
use redirect\Redirect;
use response\Response;
use view\View;interface IControllerSource 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.
No own constants, enum cases, traits or property declarations. Inherited members are documented on the parent reference page.
| 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 |
public function setRootPath(string $rootDirPath): void;| 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.
public function setViewPath(string $viewDirPath): void;| 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.
public function index(array|string $params): View|Redirect|Response;| 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.
AWT Framework Wiki · Home · Installation Guide · Developer Guide · Framework Internals
Philosophy · Architecture · Known discrepancies · Verification
Installation Guide
Developer Guide
- Learning sequence
- First package
- Package structure
- Lifecycle
- Runtimes
- Events and objects
- Routing and controllers
- Views and resources
- Database and models
- Storage and caching
- Configuration and CLI
- Responses and errors
- Extension points
Framework Internals
- Architecture
- Bootstrap
- Packages
- Runtime
- Events and context
- Objects
- HTTP routing and controllers
- Rendering
- Blade integration
- Database
- Models
- Storage and caching
- Settings
- CLI
- Identity and sessions
- Responses
- Errors
- Complete source inventory
Documentation notes