cyberfusion/domain-parser
最新稳定版本:v1.6.0
Composer 安装命令:
composer require cyberfusion/domain-parser
包简介
Library to parse domains into their subdomain, SLD, TLD, and registrable domain.
README 文档
README
Library to parse domains into their subdomain, SLD, TLD, and registrable domain.
This library is a wrapper around jeremykendall/php-domain-parser, focussed on ease of use.
Install
Composer
Run the following command to install the package from Packagist:
composer require cyberfusion/domain-parser
Usage
Example
use Cyberfusion\DomainParser\Parser; $parser = new Parser(); $parsedDomain = $parser->domain('www.cyberfusion.nl'); $parsedDomain->getRegistrableDomain(); // cyberfusion.nl $parsedDomain->getSld(); // cyberfusion $parsedDomain->getTld(); // nl $parsedDomain->hasSubdomain(): // true $parsedDomain->getSubdomain(); // www $parsedDomain->isApexDomain(); // false $parsedDomain->getFqdn(); // www.cyberfusion.nl
Providers
Public Suffix List (recommended)
$parser = new Parser(provider: new PublicSuffixList());
IANA
$parser = new Parser(provider: new IANATopLevelDomainList());
Caching
This package caches data. to prevent too many requests to providers. You can provide your own cache to Parser, or use the included file cache.
For example, use the default cache store in Laravel:
$parser = new Parser( cache: Cache::store(), provider: new PublicSuffixList() );
统计信息
- 总下载量: 4.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-21