final class Route (View source)

Adds a route configuration to a method

This is a convenient way to add routes in project code but should not be used in libraries/packages that shall be configured for different use cases.

Constants

private PRESERVED_DEFAULTS

Magic route values cannot be set as default nor be contained as segments like {\@action} or {\@controller} in the uriPattern.

The magic route value \@format is allowed if necessary.

Methods

__construct(string $uriPattern, string $name = '', array $httpMethods = [], array $defaults = [])

No description

Details

__construct(string $uriPattern, string $name = '', array $httpMethods = [], array $defaults = [])

No description

Parameters

string $uriPattern

The uri-pattern for the route without leading '/'. Might contain route values in the form of path/{foo}

string $name

The suffix of the route name as shown in route:list (defaults to the action name: "My.Package :: Site :: index")

array $httpMethods

List of uppercase http verbs like 'GET', 'POST', 'PUT', 'DELETE', if not specified any request method will be matched

array $defaults

Values to set for this route