Menu

## Routing extends Routing
in package

Routing.php : 19

Routing configuration

### Table of Contents

#### Properties

$autoRoute : bool
  If TRUE, the system will attempt to match the URI against Controllers by matching each segment against folders/files in APPPATH/Controllers, when a match wasn't found against defined routes.
$defaultController : string
  For Auto Routing.
$defaultMethod : string
  For Defined Routes and Auto Routing.
$defaultNamespace : string
  For Defined Routes and Auto Routing.
$moduleRoutes : array<string, string>
  For Auto Routing (Improved).
$multipleSegmentsOneParam : bool
  For Defined Routes.
$override404 : string|null
  Sets the class/method that should be called if routing doesn't find a match. It can be the controller/method name like: Users::index
$prioritize : bool
  For Defined Routes.
$routeFiles : array<int, string>
  For Defined Routes.
$translateURIDashes : bool
  For Auto Routing.
$translateUriToCamelCase : bool
  For Auto Routing (Improved).

### Properties

#### $autoRoute

Routing.php : 97

If TRUE, the system will attempt to match the URI against Controllers by matching each segment against folders/files in APPPATH/Controllers, when a match wasn't found against defined routes.

`public bool $autoRoute = false`

If FALSE, will stop searching and do NO automatic routing.

#### $defaultController

Routing.php : 51

For Auto Routing.

`public string $defaultController = 'Home'`

The default controller to use when no other controller has been specified.

Default: 'Home'

#### $defaultMethod

Routing.php : 60

For Defined Routes and Auto Routing.

`public string $defaultMethod = 'index'`

The default method to call on the controller when no other method has been set in the route.

Default: 'index'

#### $defaultNamespace

Routing.php : 42

For Defined Routes and Auto Routing.

`public string $defaultNamespace = 'App\Controllers'`

The default namespace to use for Controllers when no other namespace has been specified.

Default: 'App\Controllers'

#### $moduleRoutes

Routing.php : 128

For Auto Routing (Improved).

`public array<string, string> $moduleRoutes = []`

Map of URI segments and namespaces.

The key is the first URI segment. The value is the controller namespace. E.g., [ 'blog' => 'Acme\Blog\Controllers', ]

#### $multipleSegmentsOneParam

Routing.php : 114

For Defined Routes.

`public bool $multipleSegmentsOneParam = false`

If TRUE, matched multiple URI segments will be passed as one parameter.

Default: false

#### $override404

Routing.php : 87

Sets the class/method that should be called if routing doesn't find a match. It can be the controller/method name like: Users::index

`public string|null $override404 = null`

This setting is passed to the Router class and handled there.

If you want to use a closure, you will have to set it in the routes file by calling:

$routes->set404Override(function() { // Do something here });

Example: public $override404 = 'App\Errors::show404';

#### $prioritize

Routing.php : 106

For Defined Routes.

`public bool $prioritize = false`

If TRUE, will enable the use of the 'prioritize' option when defining routes.

Default: false

#### $routeFiles

Routing.php : 31

For Defined Routes.

`public array<int, string> $routeFiles = [APPPATH . 'Config/Routes.php']`

An array of files that contain route definitions. Route files are read in order, with the first match found taking precedence.

Default: APPPATH . 'Config/Routes.php'

#### $translateURIDashes

Routing.php : 69

For Auto Routing.

`public bool $translateURIDashes = false`

Whether to translate dashes in URIs for controller/method to underscores. Primarily useful when using the auto-routing.

Default: false

#### $translateUriToCamelCase

Routing.php : 139

For Auto Routing (Improved).

`public bool $translateUriToCamelCase = true`

Whether to translate dashes in URIs for controller/method to CamelCase. E.g., blog-controller -> BlogController

If you enable this, $translateURIDashes is ignored.

Default: false

## Search results