domainvalidity/php-domain-validator
最新稳定版本:2.0.3
Composer 安装命令:
composer require domainvalidity/php-domain-validator
包简介
Light PHP package to validate domains.
README 文档
README
Doma(in)Validity PHP package.
Light PHP package to validate domains.
Doma(in)Validity was born because I found myself searching online about how to check if a domain was valid. I always ended up using regular expressions that were too complex to account for several scenarios (mainly the TLD having different formats), it was just a pain in the butt because I always had to go back to that code to fix the regex to account for an edge case that I didn't think about.
Requirements
- PHP >= 8.1.0
Installation
You can install the package via composer:
composer require domainvalidity/php-domain-validator
Usage
use DomainValidity\Factory; $contents = file_get_contents('https://publicsuffix.org/list/public_suffix_list.dat'); $validator = Factory::make($contents); $host = $validator->validate('www.domainvalidity.dev');
Note: You should cache the contents of the public suffix list and download them no more than once per day, as it is not updated more than a few times per week; more frequent downloading is pointless.
统计信息
- 总下载量: 6.7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-27
