tomcan/public-suffix-list 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tomcan/public-suffix-list

最新稳定版本:v2.4.1

Composer 安装命令:

composer require tomcan/public-suffix-list

包简介

A PHP consumable version of the DNS top level domains public suffix list from publicsuffix.org.

README 文档

README

A PHP consumable version of the DNS top level domains public suffix list from publicsuffix.org. It contains the actual list, and is updated periodically.

The library also includes a easy way to check for validity, or derive the TLD from a given domain name.

Installation

You can install the library through composer

composer require tomcan/public-suffix-list

The v1.5.x versions of the library support PHP 5.6 and above. This version is no longer maintained and may or may not receive list updates, but no new features.

The v2.x.y versions of the library support PHP 7.4 and above.

Usage

There are 2 variants of the list. The PSLIcann class contains all 'official' TLDs as defined by ICANN. The 'PSLFull' class also contains private TLDs that are children of the ICANN list, but also allow registration by users, or even domains of large/popular services like AWS S3.

$psl = new PSLIcann();
// check if tld is valid
$valid = $psl->isTld('be'); // -> true
$valid = $psl->isTld('tom.be); // -> false
// get tld of given domain
$tld = $psl->getTldOfDomain('mt.tom.be'); // -> be
$tld = $psl->getTldOfDomain('oh.fc.it'); // -> fc.it

$psl = new PSLFull();
// check if tld is valid
$valid = $psl->isTld('s3.dualstack.ap-east-1.amazonaws.com'); // -> true
// get tld of given domain
$tld = $psl->getTldOfDomain('someappname.3.azurestaticapps.net'); // -> 3.azurestaticapps.net
// get type of given tld
$type = $psl->getType('be'); // -> icann
$type = $psl->getType('3.azurestaticapps.net'); // -> private

统计信息

  • 总下载量: 384
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-06