Stars: 261
Forks: 44
Pull Requests: 19
Issues: 17
Watchers: 20
Last Updated: 2021-09-16 08:14:24
A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA) for PHP. Actively maintained alternative can be found here: https://github.com/symfony/polyfill-intl-idn
License: MIT License
Languages: PHP
A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA).
composer require true/punycode:~2.0
<?php
// Import Punycode
use TrueBV\Punycode;
$Punycode = new Punycode();
var_dump($Punycode->encode('renangonçalves.com'));
// outputs: xn--renangonalves-pgb.com
var_dump($Punycode->decode('xn--renangonalves-pgb.com'));
// outputs: renangonçalves.comThis library converts a Unicode encoded domain name to a IDNA ASCII form and vice-versa.
If you can compile the needed dependencies (intl, libidn) there is not much difference. But if you want to write portable code between hosts (including Windows and Mac OS), or can't install PECL extensions, this is the right library for you.