IDN Converter - PHP Library

ConverterFactory
in package

Table of Contents

convert()  : array<string|int, mixed>
Convert a domain string between Unicode and Punycode formats.
toASCII()  : string|false
Convert a domain string to Punycode format.
toUnicode()  : string|false
Convert a domain string to Unicode format.
transitionalProcessing()  : bool
Check if the provided top-level domain (TLD) is non-transitional.
handleConversion()  : string
Handle conversion of a keyword between Unicode and Punycode formats.

Methods

convert()

Convert a domain string between Unicode and Punycode formats.

public static convert(string|array<string|int, mixed> $keywords[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$keywords : string|array<string|int, mixed>

The domain string to convert.

$options : array<string|int, mixed> = []

Additional options for the conversion process.

Return values
array<string|int, mixed>

Returns an associative array containing the converted domain in both IDN and Punycode formats.

toASCII()

Convert a domain string to Punycode format.

public static toASCII(string $keyword[, array<string|int, mixed> $options = [] ]) : string|false
Parameters
$keyword : string

The domain string to convert.

$options : array<string|int, mixed> = []

Additional options for the conversion process.

Return values
string|false

Returns the converted domain in Punycode format or false if the keyword is empty.

toUnicode()

Convert a domain string to Unicode format.

public static toUnicode(string $keyword[, array<string|int, mixed> $options = [] ]) : string|false
Parameters
$keyword : string

The domain string to convert.

$options : array<string|int, mixed> = []

Additional options for the conversion process.

Return values
string|false

Returns the converted domain in Unicode format or false if the keyword is empty.

transitionalProcessing()

Check if the provided top-level domain (TLD) is non-transitional.

public static transitionalProcessing(string $keyword[, array<string|int, mixed> $options = [] ]) : bool
Parameters
$keyword : string

The domain string to check.

$options : array<string|int, mixed> = []

Additional options for the conversion process.

Return values
bool

Returns true if the TLD is non-transitional, false otherwise.

handleConversion()

Handle conversion of a keyword between Unicode and Punycode formats.

private static handleConversion(string $keyword, array<string|int, mixed> $options, string $method) : string
Parameters
$keyword : string

The domain string to convert.

$options : array<string|int, mixed>

Additional options for the conversion process.

$method : string

The conversion method to use.

Return values
string

Returns the converted domain string.

Search results