techzolab/toolsspfcheck
最新稳定版本:v1.0.2
Composer 安装命令:
composer require techzolab/toolsspfcheck
包简介
Checks an IP address against a domain's SPF record
README 文档
README
Simple library to check an IP address against a domain's SPF record
Installation
This library is available through Composer.
Run composer require techzolab/toolsspfcheck or add this to your composer.json:
{
"require": {
"techzolab/toolsspfcheck": "^1"
}
}
Usage
Create a new instance of ToolsSPFCheck. The constructor requires a DNSRecordGetterInterface to be passed. Currently, you have two options:
DNSRecordGetterwhich uses PHP's DNS functions to get dataDNSRecordGetterDirectwhich uses the PHP DNS Direct Query Module to get data.
<?php use Nzldev\ToolsSPFCheck\ToolsSPFCheck; use Nzldev\ToolsSPFCheck\DNSRecordGetter; require('vendor/autoload.php'); $checker = new ToolsSPFCheck(new DNSRecordGetter()); // Uses php's dns_get_record method for lookup. var_dump($checker->isIPAllowed('127.0.0.1', 'test.com')); // or $checker = new ToolsSPFCheck(new DNSRecordGetterDirect("8.8.8.8")); // Uses phpdns, allowing you to set the nameserver you wish to use for the dns queries. var_dump($checker->isIPAllowed('127.0.0.1', 'test.com'));
Return value is one of ToolsSPFCheck::RESULT_PASS, ToolsSPFCheck::RESULT_FAIL, ToolsSPFCheck::RESULT_SOFTFAIL, ToolsSPFCheck::RESULT_NEUTRAL, ToolsSPFCheck::RESULT_NONE, ToolsSPFCheck::RESULT_PERMERROR, ToolsSPFCheck::RESULT_TEMPERROR
Missing features
A few features are still missing from this library at the moment. Here's a partial list of those features:
- Section 7 of RFC7208 on macros
You are very welcome to submit a pull request adding even part of those features.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-07