Idna
in package
Converts internationalized hosts to their ASCII form.
Table of Contents
Methods
- toAscii() : string
- Returns the ASCII form of a URI host.
- uriFor() : UriInterface
- Returns a URI for a string whose host may be internationalized.
Methods
toAscii()
Returns the ASCII form of a URI host.
public
static toAscii(string $host[, int|null $options = null ]) : string
A host with no non-ASCII data, raw or percent-encoded, is returned
unchanged. Any other host is converted to A-labels with the UTS #46
ToASCII operation, by default non-transitionally and with the STD3 ASCII
rules and the bidi and joiner checks. $options replaces that default
with IDNA_* constants. Whatever the options, a converted host must be a
valid ASCII host that is neither bracketed nor percent-encoded.
Conversion maps characters, so fullwidth digits can become an IPv4 address. Apply any destination policy to the returned host, not to the input.
Parameters
- $host : string
- $options : int|null = null
Tags
Return values
stringuriFor()
Returns a URI for a string whose host may be internationalized.
public
static uriFor(string $uri[, int|null $options = null ]) : UriInterface
The string is parsed exactly as new Uri($uri) parses it, except that a
host containing non-ASCII data is converted with toAscii() and the
given $options.
Parameters
- $uri : string
- $options : int|null = null