qdenka/punycode
最新稳定版本:1.2.0
Composer 安装命令:
composer require qdenka/punycode
包简介
A simple PHP library for encoding and decoding URLs to and from Punycode.
README 文档
README
Punycode Converter is a PHP library that provides functions to encode and decode URLs using Punycode.
Installation
You can install the library via Composer. Run the following command:
composer require qdenka/punycode
Usage Punycode Converter
use Qdenka\Punycode\Converter; // Encode a URL to Punycode $encodedUrl = Converter::encode('http://www.üñïçø∂é.com/привет#мир'); // Decode a Punycode URL back to its original form $decodedUrl = Converter::decode('http://xn--tda.com/'); // Encode an array of URLs to Punycode $urls = ['http://www.üñïçø.com/testcase', 'ßlåh.com']; $encodedUrls = Converter::encodeFromArray($urls); // Decode an array of Punycode URLs back to their original forms $punycodeUrls = ['xn--tda.com', 'http://www.example.com/url1']; $decodedUrls = Converter::decodeFromArray($punycodeUrls);
Usage Punycode Identifier
use Qdenka\Punycode\Identifier; // Check if a URL is encoded IDN $isPunycode = Identifier::isPunycode('http://xn--tda.com/'); // Check if a URL is Ascii $isNotPunycode = Identifier::isUnicode('http://www.üñïçø.com/');
统计信息
- 总下载量: 3.93k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-07-01