UrlRule

Type
Class
Namespace
craft\app\web
Inherits
craft\app\web\UrlRule » craft\web\UrlRule » yii\web\UrlRule (opens new window) » yii\base\BaseObject (opens new window)
Implements
yii\base\Configurable (opens new window), yii\web\UrlRuleInterface (opens new window)
Since
3.0.0

View source (opens new window)

# Public Properties

Property Description
createUrlStatus (opens new window) null (opens new window), integer (opens new window) – Status of the URL creation after the last createUrl() (opens new window) call.
defaults (opens new window) array (opens new window) – The default GET parameters (name => value) that this rule provides.
encodeParams (opens new window) boolean (opens new window) – A value indicating if parameters should be url encoded.
host (opens new window) string (opens new window) – The pattern used to parse and create the host info part of a URL (e.g. `http://example.
mode (opens new window) integer (opens new window) – A value indicating if this rule should be used for both request parsing and URL creation, parsing only, or creation only.
name (opens new window) string (opens new window) – The name of this rule.
normalizer (opens new window) yii\web\UrlNormalizer (opens new window), array (opens new window), false (opens new window), null (opens new window) – The configuration for yii\web\UrlNormalizer (opens new window) used by this rule.
params array (opens new window) – Parameters that should be passed to the controller.
pattern (opens new window) string (opens new window) – The pattern used to parse and create the path info part of a URL.
route (opens new window) string (opens new window) – The route to the controller action
suffix (opens new window) string (opens new window) – The URL suffix used for this rule.
verb (opens new window) string (opens new window), array (opens new window) – The HTTP verb (e.g. GET, POST, DELETE) that this rule should match.

# Protected Properties

Property Description
createStatus (opens new window) integer (opens new window), null (opens new window) – Status of the URL creation after the last createUrl() (opens new window) call.
placeholders (opens new window) array (opens new window) – List of placeholders for matching parameters names.

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__construct() Constructor.
__get() (opens new window) Returns the value of an object property.
__isset() (opens new window) Checks if a property is set, i.e. defined and not null.
__set() (opens new window) Sets value of an object property.
__toString() (opens new window)
__unset() (opens new window) Sets an object property to null.
canGetProperty() (opens new window) Returns a value indicating whether a property can be read.
canSetProperty() (opens new window) Returns a value indicating whether a property can be set.
className() (opens new window) Returns the fully qualified name of this class.
createUrl() (opens new window) Creates a URL according to the given route and parameters.
getCreateUrlStatus() (opens new window) Returns status of the URL creation after the last createUrl() (opens new window) call.
hasMethod() (opens new window) Returns a value indicating whether a method is defined.
hasProperty() (opens new window) Returns a value indicating whether a property is defined.
init() (opens new window) Initializes the object.
parseRequest() Parses the given request and returns the corresponding route and parameters.

# Protected Methods

Method Description
getNormalizer() (opens new window)
getParamRules() (opens new window) Returns list of regex for matching parameter.
hasNormalizer() (opens new window)
substitutePlaceholderNames() (opens new window) Iterates over placeholders (opens new window) and checks whether each placeholder exists as a key in $matches array.

# Constants

Constant Description
CREATE_STATUS_PARAMS_MISMATCH Represents the unsuccessful URL generation by last createUrl() (opens new window) call, because of mismatched or missing parameters.
CREATE_STATUS_PARSING_ONLY Represents the unsuccessful URL generation by last createUrl() (opens new window) call, because rule does not support creating URLs.
CREATE_STATUS_ROUTE_MISMATCH Represents the unsuccessful URL generation by last createUrl() (opens new window) call, because of mismatched route.
CREATE_STATUS_SUCCESS Represents the successful URL generation by last createUrl() (opens new window) call.
CREATION_ONLY Set mode (opens new window) with this value to mark that this rule is for URL creation only.
PARSING_ONLY Set mode (opens new window) with this value to mark that this rule is for URL parsing only.