PHP Class yii\validators\UrlValidator

Note that this validator only checks if the URL scheme and host part are correct. It does not check the remaining parts of a URL.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends Validator
Datei anzeigen Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$defaultScheme the default URI scheme. If the input doesn't contain the scheme part, the default scheme will be prepended to it (thus changing the input). Defaults to null, meaning a URL must contain the scheme part.
$enableIDN whether validation process should take into account IDN (internationalized domain names). Defaults to false meaning that validation of URLs containing IDN will always fail. Note that in order to use IDN validation you have to install and enable intl PHP extension, otherwise an exception would be thrown.
$pattern the regular expression used to validate the attribute value. The pattern may contain a {schemes} token that will be replaced by a regular expression which represents the [[validSchemes]].
$validSchemes list of URI schemes which should be considered valid. By default, http and https are considered to be valid schemes.

Public Methods

Method Description
clientValidateAttribute ( $model, $attribute, $view )
init ( )
validateAttribute ( $model, $attribute )

Protected Methods

Method Description
validateValue ( $value )

Method Details

clientValidateAttribute() public method

public clientValidateAttribute ( $model, $attribute, $view )

init() public method

public init ( )

validateAttribute() public method

public validateAttribute ( $model, $attribute )

validateValue() protected method

protected validateValue ( $value )

Property Details

$defaultScheme public_oe property

the default URI scheme. If the input doesn't contain the scheme part, the default scheme will be prepended to it (thus changing the input). Defaults to null, meaning a URL must contain the scheme part.
public $defaultScheme

$enableIDN public_oe property

whether validation process should take into account IDN (internationalized domain names). Defaults to false meaning that validation of URLs containing IDN will always fail. Note that in order to use IDN validation you have to install and enable intl PHP extension, otherwise an exception would be thrown.
public $enableIDN

$pattern public_oe property

the regular expression used to validate the attribute value. The pattern may contain a {schemes} token that will be replaced by a regular expression which represents the [[validSchemes]].
public $pattern

$validSchemes public_oe property

list of URI schemes which should be considered valid. By default, http and https are considered to be valid schemes.
public $validSchemes