hazaveh/verify-domain

使用PHP验证域名所有权

1.0.4 2024-06-14 10:05 UTC

This package is auto-updated.

Last update: 2024-09-14 10:38:19 UTC


README

验证域名

PHP验证域名允许您通过验证上传的 文件内容元标签TXT DNS记录 来验证域名的所有权。您可能在验证类似“Google Search Console”等服务中的域名时见过类似的行为...

您可以在这篇 博客文章 中了解更多关于Verify Domain包的信息。

此库与php > 5兼容,并且运行时依赖几乎为零。

安装

通过composer运行

composer require hazaveh/verify-domain

使用

简单地实例化VerifyDomain类或通过您的DI容器注入它。

use Hazaveh\VerifyDomain\VerifyDomain;  
    
$verify = new VerifyDomain();  

/**
* Verifies if a TXT record with the value of "php-is-awesome" exists.
 */
$byDNS = $verify->verifyByDNS('hazaveh.net', 'php-is-awesome');

/**
* Verifies "https://hazaveh.net/verification.txt" with the content of "php-is-awesome" exists.
 */
$byFile = $verify->verifyByFile("hazaveh.net", 'verification.txt', "php-is-awesome");

/**
* Verifies '<meta name="verification" content="verification-code-123">' exists on hazaveh.net
 */
$byMeta = $verify->verifyByMeta("hazaveh.net", 'verification', "verification-code-123");

贡献

添加一些酷炫的功能或修复一个损坏的杯子,运行测试并创建一个PR ❤️🚀