Yaf_Router::getRoutes

(Yaf >=1.0.0)

Yaf_Router::getRoutesRetrieve registered routes

Description

public function Yaf_Router::getRoutes(): mixed

Retrieve registered routes

Parameters

This function has no parameters.

Return Values

Examples

Example #1 Yaf_Router::getRoutes() example

<?php
class Bootstrap extends Yaf_Bootstrap_Abstract
{
    public function _initRoutes(Yaf_Dispatcher $dispatcher)
    {
        $router = $dispatcher->getRouter();

        $router->addRoute("rewrite", new Yaf_Route_Rewrite(
            "/product/:id",
            ["controller" => "product", "action" => "detail"]
        ));

        /* besides the custom one, the built-in "_default" route is
           also part of the route table */
        var_dump(array_keys($router->getRoutes()));
    }
}
?>

The above example will output something similar to:

array(2) {
  [0]=>
  string(8) "_default"
  [1]=>
  string(7) "rewrite"
}

See Also

add a note

User Contributed Notes

There are no user contributed notes for this page.