PHPackages                             mso/idna-convert - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mso/idna-convert

Abandoned → [algo26-matthias/idna-convert](/?search=algo26-matthias%2Fidna-convert)Library[Utility &amp; Helpers](/categories/utility)

mso/idna-convert
================

A library for encoding and decoding internationalized domain names

v4.2.1(7mo ago)712.3M—7.6%2613LGPL-2.1+PHPPHP &gt;=8.1CI passing

Since Jan 6Pushed 3mo ago7 watchersCompare

[ Source](https://github.com/algo26-matthias/idna-convert)[ Packagist](https://packagist.org/packages/mso/idna-convert)[ Docs](https://github.com/algo26-matthias/idna-convert)[ RSS](/packages/mso-idna-convert/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (35)Used By (13)

IDNA Convert - pure PHP IDNA converter
======================================

[](#idna-convert---pure-php-idna-converter)

[![latest stable version](https://camo.githubusercontent.com/e824732348ce4c2c8ad9b319827009a0cf9e86d7907d1645282ee1d758ea4848/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f616c676f32362d6d617474686961732f69646e612d636f6e766572742e737667)](https://camo.githubusercontent.com/e824732348ce4c2c8ad9b319827009a0cf9e86d7907d1645282ee1d758ea4848/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f616c676f32362d6d617474686961732f69646e612d636f6e766572742e737667)

Introduction
------------

[](#introduction)

The library IdnaConvert allows to convert internationalized domain names (see [RFC 3492](http://www.ietf.org/rfc/rfc3492.txt), [RFC 5890](http://www.ietf.org/rfc/rfc5890.txt), [RFC 5891](http://www.ietf.org/rfc/rfc5891.txt), [RFC 5892](http://www.ietf.org/rfc/rfc5892.txt), [RFC 5893](http://www.ietf.org/rfc/rfc5893.txt), [RFC 5894](http://www.ietf.org/rfc/rfc5894.txt), [RFC 6452](http://www.ietf.org/rfc/rfc6452.txt), for details) as they can be used with various registries worldwide to be translated between their original (localized) form and their encoded form as it will be used in the DNS (Domain Name System).

The library provides two classes (`ToIdn` and `ToUnicode` respectively), which expose three public methods to convert between the respective forms. See the Example section below. This allows you to convert host names (simple labels like `localhost` or FQHNs like `some-host.domain.example`), email addresses and complete URLs.

Errors, incorrectly encoded or invalid strings will lead to various exceptions. They should help you find out, what went wrong.

Unicode strings are expected to be UTF-8 strings. ACE strings (the Punycode form) are always 7bit ASCII strings.

Installation
------------

[](#installation)

### Via Composer

[](#via-composer)

```
composer require algo26-matthias/idna-convert

```

### Official ZIP Package

[](#official-zip-package)

The official ZIP packages are discontinued. Stick to Composer or GitHub to acquire your copy, please.

Upgrading from a previous version
---------------------------------

[](#upgrading-from-a-previous-version)

See [the upgrading notes](./UPGRADING.md) to learn about upgrading from a previous version.

Examples
--------

[](#examples)

### Example 1.

[](#example-1)

Say we wish to encode the domain name nörgler.com:

```
