PHP code example of adiafora / laravel-punycode

1. Go to this page and download the library: Download adiafora/laravel-punycode library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

adiafora / laravel-punycode example snippets


    composer 

    Adiafora\Punycode\PunycodeServiceProvider::class,

    'Punycode' => Adiafora\Punycode\Facades\Punycode::class,

    var_dump(Punycode::encode('мой-веб-сайт.сайт'));
    // outputs: xn-----8kcceszgtu3bo.xn--80aswg

    var_dump(Punycode::decode('xn-----8kcceszgtu3bo.xn--80aswg'));
    // outputs: мой-веб-сайт.сайт

    punycode_encode('мой-веб-сайт.сайт');
    punycode_decode('xn-----8kcceszgtu3bo.xn--80aswg');