true/punycode

This package is abandoned and no longer maintained. No replacement package was suggested.

A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)

Installs: 26 290 108

Dependents: 54

Suggesters: 0

Security: 0

Stars: 258

Watchers: 21

Forks: 42

Open Issues: 11

v2.1.1 2016-11-16 10:37 UTC

This package is auto-updated.

Last update: 2022-10-11 15:59:25 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version

A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA).

Install

composer require true/punycode:~2.0

Usage

<?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.com

FAQ

1. What is this library for?

This library converts a Unicode encoded domain name to a IDNA ASCII form and vice-versa.

2. Why should I use this instead of PHP's IDN Functions?

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.