mika56/spfcheck-dns-direct

Provide a DNSRecordGetterInterface for using custom DNS servers for mika56/spfcheck

Maintainers

👁 Mika56

Package info

github.com/Mika56/PHP-SPF-Check-DNS-Direct

pkg:composer/mika56/spfcheck-dns-direct

Statistics

Installs: 81 275

Dependents: 0

Suggesters: 1

Stars: 0

Open Issues: 2

2.0.2 2024-02-24 09:25 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 628f0d5ec88703451c272f7ca9ff92ea677d95bb

  • Mikael Peigney <mikael.56.woop@live.fr>
  • Brian Tafoya <btafoya.woop@briantafoya.com>

This package is auto-updated.

Last update: 2026-06-29 02:02:30 UTC


README

Provides a DNSRecordGetterInterface to allow you to use custom DNS servers with mika56/spfcheck.

It uses purplepixie/phpdns to get the DNS records.

All the code was initially written by @btafoya and extracted from the main repository to this one.

Installation

Ensure you have mika56/spfcheck installed, then require mika56/spfcheck-dns-direct:

composer require "mika56/spfcheck-dns-direct:^2.0"

Usage

Instantiate a new Mika56\SPFCheckDNSDirect\DNSRecordGetterDirect object and pass it to your Mika56\SPFCheck\SPFCheck object:

<?php
use Mika56\SPFCheck\SPFCheck;
use Mika56\SPFCheckDNSDirect\DNSRecordGetterDirect;

require('vendor/autoload.php');

$checker = new SPFCheck(new DNSRecordGetterDirect());
var_dump($checker->getIPStringResult('127.0.0.1', 'test.com'));

Note that by default, Google's 8.8.8.8 DNS servers are used. You can change this by passing arguments to the constructor:

public function __construct(
 string $nameserver = '8.8.8.8',
 int $port = 53,
 int $timeout = 30,
 bool $udp = true,
 bool $tcpFallback = true
)