New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

adiafora/laravel-punycode

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adiafora/laravel-punycode

Package for decoding domains in punycode for Laravel 5

package
Source
Packagist
Version
1.3
Version published
Total downloads
35
Maintainers
1
Created
Source

Laravel Punycode

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

This package is based on another package - fomvasss/laravel-punycode. But the idna_convert class is taken as the main class. And it allows you to use a domain in any writing: only domain, domain with www, Protocol, script, parameters, and so on.

If You accidentally encoded an English domain in punycode, then nothing will happen to it, no errors and unexpected results. You can safely use this package on all domains, it will do everything for You.

Install

Run:

    composer require "adiafora/laravel-punycode"

For Laravel < 5.5 Add in ServiceProvider to the providers array in config/app.php

    Adiafora\Punycode\PunycodeServiceProvider::class,

Usage

Usage facade

You can now using the Facade by default.

For Laravel < 5.5 Add in Facade to the aliases array in config/app.php

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

Example usage:

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

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

Usage helper functions

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

License

Faker is released under the MIT Licence. See the bundled LICENSE file for details.

Keywords

laravel

FAQs

Package last updated on 23 Jul 2019

Related posts