php8.5
Home/ Manual/ yaf / yaf_router/ Yaf_Router::__construct

Yaf_Router::__construct

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Yaf_Router constructor

Description

Yaf_Router::__construct()

Parameters Parameters

Return Values

Examples

Yaf_Router::__construct example

In normal usage the router is not constructed manually, it is owned by the dispatcher:

php
<?php
/* in index.php or a plugin, obtain the router from the dispatcher */
$router = Yaf_Dispatcher::getInstance()->getRouter();
var_dump($router);
?>

The above example will output something similar to:

output
object(Yaf_Router)#4 (1) {
}

See Also

  • Yaf_Dispatcher::getRouter
  • Yaf_Router::addRoute

Source: reference/yaf/yaf_router/construct.xml · from the official PHP manual (php/doc-en)