true/punycode
Pure PHP Punycode encoder/decoder for Internationalized Domain Names (IDNA). Convert Unicode domains to ASCII xn-- form and back (e.g., renangonçalves.com ↔ xn--renangonalves-pgb.com) without requiring the intl/libidn extensions.
Install via Composer: composer require true/punycode. Immediately use it to convert Unicode domain names (e.g., renangonçalves.com) to ASCII-compatible Punycode (xn--renangonalves-pgb.com) and vice versa. The most common first use case is normalizing user-input or external domain names before storing or comparing them—especially in multilingual applications where domains contain non-ASCII characters like accents or Cyrillic. Start by instantiating TrueBV\Punycode and calling encode()/decode() on individual domain names.
ext-intl isn’t available (e.g., minimal CI runners) to ensure portable IDN behavior across environments—just ensure version compatibility (v2.1.0+ is RFC-compliant).For cleaner Laravel integration, wrap instantiation in a singleton service (e.g., bind TrueBV\Punycode::class in a service provider) or create a dedicated helper class (e.g., app(Punycode::class)->encode($domain)), enabling easy swapping if migrating to symfony/polyfill-intl-idn.
symfony/polyfill-intl-idn, which Laravel already uses internally.Xn--Renan... vs xn--renan...).TrueBV (not True) due to PHP 7 reserved words—double-check imports and avoid use True; to prevent parse errors.How can I help you explore Laravel packages today?