"Mailto" URI handler

The 'mailto:...' scheme is loosely defined in RFC-1738

 Methods

Create a new URI object

__construct(\Zend\Uri\Uri | string | null $uri) 
Inherited

inherited_from \Zend\Uri\Uri::__construct()

Parameters

$uri

\Zend\Uri\Uristringnull

Exceptions

\Zend\Uri\Exception\InvalidArgumentException

Magic method to convert the URI to a string

__toString() : string
Inherited

inherited_from \Zend\Uri\Uri::__toString()

Returns

string

Encode the path

encodePath(string $path) : string
Inherited

Will replace all characters which are not strictly allowed in the path part with percent-encoded representation

inherited_from \Zend\Uri\Uri::encodePath()

Parameters

$path

string

Exceptions

\Zend\Uri\Exception\InvalidArgumentException

Returns

string

URL-encode a query string or fragment based on RFC-3986 guidelines.

encodeQueryFragment(string $input) : string
Inherited

Note that query and fragment encoding allows more unencoded characters than the usual rawurlencode() function would usually return - for example '/' and ':' are allowed as literals.

inherited_from \Zend\Uri\Uri::encodeQueryFragment()

Parameters

$input

string

Exceptions

\Zend\Uri\Exception\InvalidArgumentException

Returns

string

URL-encode the user info part of a URI

encodeUserInfo(string $userInfo) : string
Inherited

inherited_from \Zend\Uri\Uri::encodeUserInfo()

Parameters

$userInfo

string

Exceptions

\Zend\Uri\Exception\InvalidArgumentException

Returns

string

Get the email address

getEmail() : string

This is infact equivalent to getPath() - but provides a more clear interface

Returns

string

Retrieve Escaper instance

getEscaper() : \Zend\Escaper\Escaper
Inherited

Lazy-loads one if none provided

inherited_from \Zend\Uri\Uri::getEscaper()

Returns

Get the URI fragment

getFragment() : string | null
Inherited

inherited_from \Zend\Uri\Uri::getFragment()

Returns

stringnull

Get the URI host

getHost() : string | null
Inherited

inherited_from \Zend\Uri\Uri::getHost()

Returns

stringnull

Get the URI path

getPath() : string | null
Inherited

inherited_from \Zend\Uri\Uri::getPath()

Returns

stringnull

Get the URI port

getPort() : int | null
Inherited

inherited_from \Zend\Uri\Uri::getPort()

Returns

intnull

Get the URI query

getQuery() : string | null
Inherited

inherited_from \Zend\Uri\Uri::getQuery()

Returns

stringnull

Return the query string as an associative array of key => value pairs

getQueryAsArray() : array
Inherited

This is an extension to RFC-3986 but is quite useful when working with most common URI types

inherited_from \Zend\Uri\Uri::getQueryAsArray()

Returns

array

Get the scheme part of the URI

getScheme() : string | null
Inherited

inherited_from \Zend\Uri\Uri::getScheme()

Returns

stringnull

Get the User-info (usually user:password) part

getUserInfo() : string | null
Inherited

inherited_from \Zend\Uri\Uri::getUserInfo()

Returns

stringnull

Retrieve validator for use with validating email address

getValidator() : \Zend\Validator\ValidatorInterface

If none is currently set, an EmailValidator instance with default options will be used.

Returns

Check if the URI is an absolute or relative URI

isAbsolute() : bool
Inherited

inherited_from \Zend\Uri\Uri::isAbsolute()

Returns

bool

Check if the URI is a valid Mailto URI

isValid() : bool

This applies additional specific validation rules beyond the ones required by the generic URI syntax

see \Zend\Uri\Uri::isValid()

Returns

bool

Check if the URI is a valid relative URI

isValidRelative() : bool
Inherited

inherited_from \Zend\Uri\Uri::isValidRelative()

Returns

bool

Convert the link to a relative link by substracting a base URI

makeRelative(\Zend\Uri\Uri | string $baseUri) : \Zend\Uri\Uri
Inherited

This is the opposite of resolving a relative link - i.e. creating a relative reference link from an original URI and a base URI.

If the two URIs do not intersect (e.g. the original URI is not in any way related to the base URI) the URI will not be modified.

inherited_from \Zend\Uri\Uri::makeRelative()

Parameters

$baseUri

\Zend\Uri\Uristring

Returns

Merge a base URI and a relative URI into a new URI object

merge(\Zend\Uri\Uri | string $baseUri, \Zend\Uri\Uri | string $relativeUri) : \Zend\Uri\Uri
Inherited

This convenience method wraps ::resolve() to allow users to quickly create new absolute URLs without the need to instantiate and clone URI objects.

If objects are passed in, none of the passed objects will be modified.

inherited_from \Zend\Uri\Uri::merge()

Parameters

$baseUri

\Zend\Uri\Uristring

$relativeUri

\Zend\Uri\Uristring

Returns

Normalize the URI

normalize() : \Zend\Uri\Uri
Inherited

Normalizing a URI includes removing any redundant parent directory or current directory references from the path (e.g. foo/bar/../baz becomes foo/baz), normalizing the scheme case, decoding any over-encoded characters etc.

Eventually, two normalized URLs pointing to the same resource should be equal even if they were originally represented by two different strings

inherited_from \Zend\Uri\Uri::normalize()

Returns

Parse a URI string

parse(string $uri) : \Zend\Uri\Uri
Inherited

inherited_from \Zend\Uri\Uri::parse()

Parameters

$uri

string

Returns

Extract only the scheme part out of a URI string.

parseScheme(string $uriString) : string | null
Inherited

This is used by the parse() method, but is useful as a standalone public method if one wants to test a URI string for it's scheme before doing anything with it.

Will return the scheme if found, or NULL if no scheme found (URI may still be valid, but not full)

inherited_from \Zend\Uri\Uri::parseScheme()

Parameters

$uriString

string

Exceptions

\Zend\Uri\Exception\InvalidArgumentException

Returns

stringnull

Remove any extra dot segments (/.

removePathDotSegments(string $path) : string
Inherited

./, /./) from a path

Algorithm is adapted from RFC-3986 section 5.2.4 (@link http://tools.ietf.org/html/rfc3986#section-5.2.4)

inherited_from \Zend\Uri\Uri::removePathDotSegments()

Parameters

$path

string

Returns

string

Convert a relative URI into an absolute URI using a base absolute URI as a reference.

resolve(\Zend\Uri\Uri | string $baseUri) : \Zend\Uri\Uri
Inherited

This is similar to merge() - only it uses the supplied URI as the base reference instead of using the current URI as the base reference.

Merging algorithm is adapted from RFC-3986 section 5.2 (@link http://tools.ietf.org/html/rfc3986#section-5.2)

inherited_from \Zend\Uri\Uri::resolve()

Parameters

$baseUri

\Zend\Uri\Uristring

Exceptions

\Zend\Uri\Exception\InvalidArgumentException

Returns

Set the email address

setEmail(string $email) : \Zend\Uri\Mailto

This is in fact equivalent to setPath() - but provides a more clear interface

Parameters

$email

string

Returns

Set Escaper instance

setEscaper(\Zend\Escaper\Escaper $escaper) 
Inherited

inherited_from \Zend\Uri\Uri::setEscaper()

Parameters

Set the URI fragment part

setFragment(string $fragment) : \Zend\Uri\Uri
Inherited

inherited_from \Zend\Uri\Uri::setFragment()

Parameters

$fragment

string

Exceptions

\Zend\Uri\Exception\InvalidUriPartException If the schema definition does not have this part

Returns

Set the URI host

setHost(string $host) : \Zend\Uri\Uri
Inherited

Note that the generic syntax for URIs allows using host names which are not necessarily IPv4 addresses or valid DNS host names. For example, IPv6 addresses are allowed as well, and also an abstract "registered name" which may be any name composed of a valid set of characters, including, for example, tilda (~) and underscore (_) which are not allowed in DNS names.

Subclasses of Uri may impose more strict validation of host names - for example the HTTP RFC clearly states that only IPv4 and valid DNS names are allowed in HTTP URIs.

inherited_from \Zend\Uri\Uri::setHost()

Parameters

$host

string

Exceptions

\Zend\Uri\Exception\InvalidUriPartException

Returns

Set the path

setPath(string $path) : \Zend\Uri\Uri
Inherited

inherited_from \Zend\Uri\Uri::setPath()

Parameters

$path

string

Returns

Set the port part of the URI

setPort(int $port) : \Zend\Uri\Uri
Inherited

inherited_from \Zend\Uri\Uri::setPort()

Parameters

$port

int

Returns

Set the query string

setQuery(string | array $query) : \Zend\Uri\Uri
Inherited

If an array is provided, will encode this array of parameters into a query string. Array values will be represented in the query string using PHP's common square bracket notation.

inherited_from \Zend\Uri\Uri::setQuery()

Parameters

$query

stringarray

Returns

Set the URI scheme

setScheme(string $scheme) : \Zend\Uri\Uri
Inherited

If the scheme is not valid according to the generic scheme syntax or is not acceptable by the specific URI class (e.g. 'http' or 'https' are the only acceptable schemes for the Zend\Uri\Http class) an exception will be thrown.

You can check if a scheme is valid before setting it using the validateScheme() method.

inherited_from \Zend\Uri\Uri::setScheme()

Parameters

$scheme

string

Exceptions

\Zend\Uri\Exception\InvalidUriPartException

Returns

Set the URI User-info part (usually user:password)

setUserInfo(string $userInfo) : \Zend\Uri\Uri
Inherited

inherited_from \Zend\Uri\Uri::setUserInfo()

Parameters

$userInfo

string

Exceptions

\Zend\Uri\Exception\InvalidUriPartException If the schema definition does not have this part

Returns

Set validator to use when validating email address

setValidator(\Zend\Validator\ValidatorInterface $validator) : \Zend\Uri\Mailto

Compose the URI into a string

toString() : string
Inherited

inherited_from \Zend\Uri\Uri::toString()

Exceptions

\Zend\Uri\Exception\InvalidUriException

Returns

string

Validate the host part

validateHost(string $host, int $allowed) : bool
Inherited

Users may control which host types to allow by passing a second parameter with a bitmask of HOST_* constants which are allowed. If not specified, all address types will be allowed.

Note that the generic URI syntax allows different host representations, including IPv4 addresses, IPv6 addresses and future IP address formats enclosed in square brackets, and registered names which may be DNS names or even more complex names. This is different (and is much more loose) from what is commonly accepted as valid HTTP URLs for example.

inherited_from \Zend\Uri\Uri::validateHost()

Parameters

$host

string

$allowed

int

bitmask of allowed host types

Returns

bool

Validate the path

validatePath(string $path) : bool
Inherited

inherited_from \Zend\Uri\Uri::validatePath()

Parameters

$path

string

Returns

bool

Validate the port

validatePort(int $port) : bool
Inherited

Valid values include numbers between 1 and 65535, and empty values

inherited_from \Zend\Uri\Uri::validatePort()

Parameters

$port

int

Returns

bool

Check if a URI query or fragment part is valid or not

validateQueryFragment(string $input) : bool
Inherited

Query and Fragment parts are both restricted by the same syntax rules, so the same validation method can be used for both.

You can encode a query or fragment part to ensure it is valid by passing it through the encodeQueryFragment() method.

inherited_from \Zend\Uri\Uri::validateQueryFragment()

Parameters

$input

string

Returns

bool

Check if a scheme is valid or not

validateScheme(string $scheme) : bool
Inherited

Will check $scheme to be valid against the generic scheme syntax defined in RFC-3986. If the class also defines specific acceptable schemes, will also check that $scheme is one of them.

inherited_from \Zend\Uri\Uri::validateScheme()

Parameters

$scheme

string

Returns

bool

Check that the userInfo part of a URI is valid

validateUserInfo(string $userInfo) : bool
Inherited

inherited_from \Zend\Uri\Uri::validateUserInfo()

Parameters

$userInfo

string

Returns

bool

Decode all percent encoded characters which are allowed to be represented literally

decodeUrlEncodedChars(string $input, string $allowed) : mixed
Inherited

Will not decode any characters which are not listed in the 'allowed' list

inherited_from \Zend\Uri\Uri::decodeUrlEncodedChars()

Parameters

$input

string

$allowed

string

Pattern of allowed characters

Returns

mixed

Check if an address is a valid DNS hostname

isValidDnsHostname(string $host) : bool
Inherited

inherited_from \Zend\Uri\Uri::isValidDnsHostname()

Parameters

$host

string

Returns

bool

Check if a host name is a valid IP address, depending on allowed IP address types

isValidIpAddress(string $host, int $allowed) : bool
Inherited

inherited_from \Zend\Uri\Uri::isValidIpAddress()

Parameters

$host

string

$allowed

int

allowed address types

Returns

bool

Check if an address is a valid registered name (as defined by RFC-3986) address

isValidRegName(string $host) : bool
Inherited

inherited_from \Zend\Uri\Uri::isValidRegName()

Parameters

$host

string

Returns

bool

Normalize the fragment part

normalizeFragment(string $fragment) : string
Inherited

Currently this is exactly the same as normalizeQuery().

inherited_from \Zend\Uri\Uri::normalizeFragment()

Parameters

$fragment

string

Returns

string

Normalize the host part

normalizeHost(string $host) : string
Inherited

By default this converts host names to lower case

inherited_from \Zend\Uri\Uri::normalizeHost()

Parameters

$host

string

Returns

string

Normalize the path

normalizePath(string $path) : string
Inherited

This involves removing redundant dot segments, decoding any over-encoded characters and encoding everything that needs to be encoded and is not

inherited_from \Zend\Uri\Uri::normalizePath()

Parameters

$path

string

Returns

string

Normalize the port

normalizePort(int $port, string $scheme) : int | null
Inherited

If the class defines a default port for the current scheme, and the current port is default, it will be unset.

inherited_from \Zend\Uri\Uri::normalizePort()

Parameters

$port

int

$scheme

string

Returns

intnull

Normalize the query part

normalizeQuery(string $query) : string
Inherited

This involves decoding everything that doesn't need to be encoded, and encoding everything else

inherited_from \Zend\Uri\Uri::normalizeQuery()

Parameters

$query

string

Returns

string

Normalize the scheme

normalizeScheme(string $scheme) : string
Inherited

Usually this means simply converting the scheme to lower case

inherited_from \Zend\Uri\Uri::normalizeScheme()

Parameters

$scheme

string

Returns

string

Reset URI parts

reset() 
Inherited

inherited_from \Zend\Uri\Uri::reset()

 Properties

 

List of default ports per scheme

$defaultPorts : array
Inherited

Inheriting URI classes may set this, and the normalization methods will automatically remove the port if it is equal to the default port for the current scheme

inherited_from \Zend\Uri\Uri::$$defaultPorts
 

Validator for use when validating email address

$emailValidator : \Zend\Validator\ValidatorInterface

 

$escaper

$escaper : \Zend\Escaper\Escaper
Inherited

inherited_from \Zend\Uri\Uri::$$escaper
 

URI fragment

$fragment : string
Inherited

inherited_from \Zend\Uri\Uri::$$fragment
 

URI hostname

$host : string
Inherited

inherited_from \Zend\Uri\Uri::$$host
 

URI path

$path : string
Inherited

inherited_from \Zend\Uri\Uri::$$path
 

URI port

$port : int
Inherited

inherited_from \Zend\Uri\Uri::$$port
 

URI query string

$query : string
Inherited

inherited_from \Zend\Uri\Uri::$$query
 

URI scheme

$scheme : string
Inherited

inherited_from \Zend\Uri\Uri::$$scheme
 

URI userInfo part (usually user:password in HTTP URLs)

$userInfo : string
Inherited

inherited_from \Zend\Uri\Uri::$$userInfo
 

Which host part types are valid for this URI?

$validHostTypes : int
Inherited

inherited_from \Zend\Uri\Uri::$$validHostTypes
 

Array of valid schemes.

$validSchemes : array

Subclasses of this class that only accept specific schemes may set the list of accepted schemes here. If not empty, when setScheme() is called it will only accept the schemes listed here.

 Constants

 

CHAR_GEN_DELIMS

CHAR_GEN_DELIMS 
Inherited

inherited_from \Zend\Uri\Uri::CHAR_GEN_DELIMS
 

Not in the spec - those characters have special meaning in urlencoded query parameters

CHAR_QUERY_DELIMS 
Inherited

inherited_from \Zend\Uri\Uri::CHAR_QUERY_DELIMS
 

CHAR_RESERVED

CHAR_RESERVED 
Inherited

inherited_from \Zend\Uri\Uri::CHAR_RESERVED
 

CHAR_SUB_DELIMS

CHAR_SUB_DELIMS 
Inherited

inherited_from \Zend\Uri\Uri::CHAR_SUB_DELIMS
 

Character classes defined in RFC-3986

CHAR_UNRESERVED 
Inherited

inherited_from \Zend\Uri\Uri::CHAR_UNRESERVED
 

HOST_ALL

HOST_ALL 
Inherited

inherited_from \Zend\Uri\Uri::HOST_ALL
 

HOST_DNS

HOST_DNS 
Inherited

inherited_from \Zend\Uri\Uri::HOST_DNS
 

HOST_DNS_OR_IPV4

HOST_DNS_OR_IPV4 
Inherited

inherited_from \Zend\Uri\Uri::HOST_DNS_OR_IPV4
 

HOST_DNS_OR_IPV4_OR_IPV6

HOST_DNS_OR_IPV4_OR_IPV6 
Inherited

inherited_from \Zend\Uri\Uri::HOST_DNS_OR_IPV4_OR_IPV6
 

HOST_DNS_OR_IPV4_OR_IPV6_OR_REGNAME

HOST_DNS_OR_IPV4_OR_IPV6_OR_REGNAME 
Inherited

inherited_from \Zend\Uri\Uri::HOST_DNS_OR_IPV4_OR_IPV6_OR_REGNAME
 

HOST_DNS_OR_IPV6

HOST_DNS_OR_IPV6 
Inherited

inherited_from \Zend\Uri\Uri::HOST_DNS_OR_IPV6
 

HOST_DNS_OR_IPVANY

HOST_DNS_OR_IPVANY 
Inherited

inherited_from \Zend\Uri\Uri::HOST_DNS_OR_IPVANY
 

Host part types represented as binary masks The binary mask consists of 5 bits in the following order: <RegName> | <DNS> | <IPvFuture> | <IPv6> | <IPv4> Place 1 or 0 in the different positions for enable or disable the part.

HOST_IPV4 
Inherited

Finally use a hexadecimal representation.

inherited_from \Zend\Uri\Uri::HOST_IPV4
 

HOST_IPV6

HOST_IPV6 
Inherited

inherited_from \Zend\Uri\Uri::HOST_IPV6
 

HOST_IPVANY

HOST_IPVANY 
Inherited

inherited_from \Zend\Uri\Uri::HOST_IPVANY
 

HOST_IPVFUTURE

HOST_IPVFUTURE 
Inherited

inherited_from \Zend\Uri\Uri::HOST_IPVFUTURE
 

HOST_REGNAME

HOST_REGNAME 
Inherited

inherited_from \Zend\Uri\Uri::HOST_REGNAME