x2nx/domain-parser
Composer 安装命令:
composer require x2nx/domain-parser
包简介
Returns complete whois and domain info parser domain information
README 文档
README
Returns complete whois and domain info parser domain information
Getting Started
Install using composer:
composer require x2nx/domain-parser
X2nx Domains parser uses a public suffix PHP dataset auto-generated from the publicsuffix.org. The dataset get periodically updates from us, but you can also manually update it by cloning this library and running the import script with the import command:
php ./data/import.php
If you want to parse ordinary web urls then use
$host = parse_url($return, PHP_URL_HOST); $domain = new \X2nx\DomainParser\Parser($host);to get the domain object.
Library API
- get() - Return you full domain name.
- getTLD() - Return only the top-level-domain.
- getSuffix() - Return only the public suffix of your domain, for example: co.uk, ac.be, org.il, com, org.
- getRegisterable() - Return the registered or registrable domain, which is the public suffix plus one additional label.
- getName() - Returns only the registerable domain name. For example, blog.example.com will return 'example', and demo.co.uk will return 'demo'.
- getSub() - Returns the full sub domain path for you domain. For example, blog.example.com will return 'blog', and subdomain.demo.cn will return 'subdomain.demo'.
- getWhoisServer() - Returns whois server url info.
- getWhoisInfo() - Returns whois info.
- getWhoisFormatted() - Returns formatted whois information.
- getWhoisParsed() - Returns whois structured data.
- getRdapServer() - Returns rdap server url info.
- getRdapInfo() - Returns rdap info.
- getRdapFormatted() - Returns formatted rdap information.
- getRdapParsed() - Returns rdap structured data.
- isKnown() - Returns true if public suffix is know and false otherwise.
- isICANN() - Returns true if the public suffix is found in the ICANN DOMAINS section of the public suffix list.
- isPrivate() - Returns true if the public suffix is found in the PRIVATE DOMAINS section of the public suffix list.
- isTest() - Returns true if the domain TLD is 'locahost' or 'test' and false otherwise.
Support functions
- iana_whois($domain,$is_server) Return the original whois information of the domain name
- iana_domain($domain) Return the components of the domain name, including subdomain, name, top-level domain, original whois information, etc
- iana_domain_info($domain, $format) Returns the unified structure information of the domain name. The first parameter is the domain name, and the second parameter is the return format. The return format supports text|array|json
Copyright and license
The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php
x2nx/domain-parser 适用场景与选型建议
x2nx/domain-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 65 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 x2nx/domain-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 x2nx/domain-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 65
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-02