CodeIgniter v4.5 API

RouterInterface

Expected behavior of a Router.

Table of Contents

Methods

__construct()  : mixed
Stores a reference to the RouteCollection object.
controllerName()  : callable(mixed...): Array|string
Returns the name of the matched controller.
handle()  : callable(mixed...): Array|string
Finds the controller method corresponding to the URI.
methodName()  : string
Returns the name of the method in the controller to run.
params()  : array<string|int, mixed>
Returns the binds that have been matched and collected during the parsing process as an array, ready to send to instance->method(...$params).
setIndexPage()  : RouterInterface
Sets the value that should be used to match the index.php file. Defaults to index.php but this allows you to modify it in case you are using something like mod_rewrite to remove the page. This allows you to set it a blank.

Methods

controllerName()

Returns the name of the matched controller.

public controllerName() : callable(mixed...): Array|string
Return values
callable(mixed...): Array|string

Controller classname or Closure

handle()

Finds the controller method corresponding to the URI.

public handle([string|null $uri = null ]) : callable(mixed...): Array|string
Parameters
$uri : string|null = null

URI path relative to baseURL

Return values
callable(mixed...): Array|string

Controller classname or Closure

methodName()

Returns the name of the method in the controller to run.

public methodName() : string
Return values
string

params()

Returns the binds that have been matched and collected during the parsing process as an array, ready to send to instance->method(...$params).

public params() : array<string|int, mixed>
Return values
array<string|int, mixed>

setIndexPage()

Sets the value that should be used to match the index.php file. Defaults to index.php but this allows you to modify it in case you are using something like mod_rewrite to remove the page. This allows you to set it a blank.

public setIndexPage(string $page) : RouterInterface
Parameters
$page : string
Return values
RouterInterface

        
On this page

Search results