fomvasss / laravel-punycode
Package for encoding of Unicode for Internationalized Domain Names in Applications (IDNA)
Installs: 20 088
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 4
Open Issues: 0
Type:package
Requires
- php: >=5.5.9
- illuminate/support: 5.4.*|5.5.*|5.6.*|^6.0|^7.0|^8.0
README
This package converts a Unicode encoded domain name to a IDNA ASCII form and vice-versa.
Install
Run:
composer require "fomvasss/laravel-punycode"
For Laravel < 5.5 Add in ServiceProvider to the providers array in config/app.php
Fomvasss\Punycode\PunycodeServiceProvider::class,
Publish configs (optional):
php artisan vendor:publish --provider="Fomvasss\Punycode\PunycodeServiceProvider" --tag="config"
Usage
Usage facade
You can now using the facade, using the PSR-3 levels (encode, decode): Add in your class the facade:
use Fomvasss\Punycode\Facades\Punycode;
Example usage:
var_dump(Punycode::encode('веб-вест.сайт')); // outputs: xn----9sbccmd8fi.xn--80aswg; var_dump(Punycode::decode('xn----9sbccmd8fi.xn--80aswg')); // outputs: веб-вест.сайт
#Usage helper functions
punycode_encode('веб-вест.сайт'); punycode_decode('xn----9sbccmd8fi.xn--80aswg');
Links:
License
Faker is released under the MIT Licence. See the bundled LICENSE file for details.