1. Go to this page and download the library: Download rowbot/idna library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rowbot / idna example snippets
use Rowbot\Idna\Idna;
$result = Idna::toAscii('x-.xn--nxa');
// You must not use an ASCII domain that has errors.
if ($result->hasErrors()) {
throw new \Exception();
}
echo $result->getDomain(); // x-.xn--nxa
use Rowbot\Idna\Idna;
$result = Idna::toUnicode('xn---with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n.com');
echo $result->getDomain(); // 安室奈美恵-with-super-monkeys.com