Documentation for crwlr / url (v1.1)

Attention: You're currently viewing the documentation for v1.1 of the url package.
This is not the latest version of the package.
If you didn't navigate to this version intentionally, you can click here to switch to the latest version.

Handling Internationalized domain names (IDN)

echo Url::parse('https://www.пример.онлайн/hello/world')->toString();

Output

https://www.xn--e1afmkfd.xn--80asehdb/hello/world

Behind the curtains symfony/polyfill-intl-idn is used, so you don't need to have the internationalization PHP extension installed to parse internationalized domain names.

To check if a url contains an internationalized domain name you can use the hasIdn method:

Url::parse('https://www.example.com')->hasIdn();           // => false
Url::parse('https://www.müller.de')->hasIdn();             // => true
Url::parse('https://www.xn--m1adged4c3a.com')->hasIdn();   // => true