Router
class Router
URL Router Used in managing page routes.
Adapted from october\rain\router\Router
Properties
static string | $defaultValue | ||
protected array | $routeMap | ||
protected Rule | $matchedRouteRule | ||
protected array | $parameters |
Methods
Registers a new route rule
Match given URL string
Builds a URL together by matching route name and supplied parameters
Builds a URL together by matching route pattern and supplied parameters
Returns the active list of router rule objects
Returns a list of parameters specified in the requested page URL.
Returns the matched route rule name.
Sorts all the routing rules by static segments, then dynamic
Details
at line 38
route($name, $route)
Registers a new route rule
at line 49
bool
match(string $url)
Match given URL string
at line 99
string
url(string $name, array $parameters = [])
Builds a URL together by matching route name and supplied parameters
at line 119
string
urlFromPattern(string $pattern, array $parameters = [])
Builds a URL together by matching route pattern and supplied parameters
at line 211
array
getRouteMap()
Returns the active list of router rule objects
at line 223
array
getParameters()
Returns a list of parameters specified in the requested page URL.
For example, if the URL pattern was /blog/post/:id and the actual URL was /blog/post/10, the $parameters['id'] element would be 10.
at line 232
Rule
matchedRoute()
Returns the matched route rule name.
at line 245
Router
reset()
Clears all existing routes
at line 256
void
sortRules()
Sorts all the routing rules by static segments, then dynamic