ice framework documentation ice doc v1.6.2
Methods
Methods Details
  • public function getRoutes()

  • public function getMethod()

  • public function getModule()

  • public function getHandler()

  • public function getAction()

  • public function getParams()

  • public function getSilent()

  • public function setSilent(variable $silent)

  • public function getDefaultModule()

  • public function setDefaultModule(variable $defaultModule)

  • public function getDefaultHandler()

  • public function setDefaultHandler(variable $defaultHandler)

  • public function getDefaultAction()

  • public function setDefaultAction(variable $defaultAction)

  • public function addRoute(string $name, string $uri, array $regex, variable $method)

    Stores a named route and returns it.
    
             $router->addRoute("default", "[/{controller}[/{action}[/{id}]]]")
                 ->setDefaults(["controller" => "hello"]);
         
  • public function getRoute(string $name)

    Retrieves a named route or the current matched route.
    
             $route = $router->getRoute("default");
         
  • public function getRouteName(variable $route)

    Get the name of a route.
  • public function cache(string $file)

    Saves or loads the route cache.
    
             if (! $router->cache()) {
                 // set routes
                 $router->addRoute("default", "[/{controller}[/{action}[/{id}]]]");
                 // cache routes
                 $router->cache($filePath);
             }
         
  • public function defaults(array $defaults)

    Set defaults values
    
             $route->defaults(["controller" => "hello", "action" => "world"]);
         
  • public function setRoutes(array $routes)

    Set an array of route rules.
    httpMethod: |null - no limit, GET, POST, PUT or PATCH URI pattern: [] wrap for optional, {} wrap for regex placeholder key regex: an associate array placeholder key and regex limitation pattern defaults: default options for the module, handler and action
    
             // the rule format: ['name' => ["httpMethod", "URI pattern", "regex", "defaults"]]
             $route->setRoutes([
                 ["default" => ["POST", "/{controller}[.ext]", ["controller" => "[a-z]+", "ext" => "(?:htm|html)"]]]
             ]);
         
  • public function handle(string $method, string $uri)

    Handles routing information.
  • public function match(string $uri, string $method)

    Get route matched by uri and method.
  • public function uri(array $params, string $method)

    Generates a URI based on the parameters given. (AKA. reverse route).
    
             $uri = $router->uri(["controller" => "blog", "action" => "post", "param" => 10]);
         
  • internal function zephir_init_properties_Ice_Mvc_Router()