mabrahamde / idna-converter
Converts domain names between UTF-8 and ASCII (punycode) notation. This is a fork of phlyLabs' pure PHP IDNA Converter
Installs: 48 011
Dependents: 0
Suggesters: 1
Security: 0
Stars: 7
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: >=5.0.0
This package is auto-updated.
Last update: 2020-01-13 23:12:22 UTC
README
mabrahamde/php-idna-converter is a fork of phlyLabs' pure PHP IDNA Converter. It converts internationalized domain names between UTF-8 and ASCII (punycode) notation.
Unlike the original mabrahamde/php-idna-converter is available on packagist.org.
If you have installed PHP >= 5.3, PECL intl >= 1.0.2, PECL idn >= 0.1. You can rely on the PHP IDN functions.
Installation
Via composer
Add the package to your composer.json
file:
{
"require": {
"mabrahamde/idna-converter": "dev-master",
},
}
Run composer.phar update
.
Usage
This library is used exactly as the original. The original documentation is available at src/ReadMe.txt
and src/example.php
.
The following example describes basic usage.
<?php
require_once('vendor/autoload.php');
$idn = new \idna_convert(array('idn_version' => 2008));
echo $idn->encode('lübeck.de'); // prints 'xn--lbeck-kva.de'
echo $idn->decode('xn--lbeck-kva.de') // prints 'lübeck.de'
?>
Contact
Do you have any questions or suggestions? Feel free to contact me at dev ( at ) mabraham.de
.