Skip to content

ivt/PHP-SPF-Check

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-SPF-Check

Build Status HHVM Latest Stable Version Total Downloads License Coverage Status

Simple library to check an IP address against a domain's SPF record

Installation

This library is available through Composer. Run composer require mika56/spfcheck or add this to your composer.json:

{
  "require": {
    "mika56/spfcheck": "dev-master"
  }
}

Usage

Create a new instance of SPFCheck. The constructor requires a DNSRecordGetterInterface to be passed. Currently, only DNSRecordGetter exists, which uses PHP's DNS functions to get data.

<?php
use Mika56\SPFCheck\SPFCheck;
use Mika56\SPFCheck\DNSRecordGetter;

require('vendor/autoload.php');
$checker = new SPFCheck(new DNSRecordGetter());
var_dump($checker->isIPAllowed('127.0.0.1', 'test.com'));

Return value is one of SPFCheck::RESULT_PASS, SPFCheck::RESULT_FAIL, SPFCheck::RESULT_SOFTFAIL, SPFCheck::RESULT_NEUTRAL, SPFCheck::RESULT_NONE, SPFCheck::RESULT_PERMERROR, SPFCheck::RESULT_TEMPERROR

Missing features

A few features are still missing from this library at the moment. Here's a partial list of those features:

You are very welcome to submit a pull request adding even part of those features.

About

Simple library to check an IP address against a domain's SPF record

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%