palpalani/laravel-dns-deny-list-check
illuminate/support and php-dns for DNS resolution). No database or external service requirements beyond DNS queries.config/dns-deny-list.php, enabling easy adjustments without code changes.DenyListCheckFailed, DenyListCheckPassed) for observability and custom logic (e.g., logging, rate-limiting).php-dns with dns_get_record).DenyListCheckJob).Mail::send()).zen.spamhaus.org).config/dns-deny-list.php with required blacklists.'blacklists' => [
'spamhaus' => 'zen.spamhaus.org',
'sbl' => 'sbl.spamhaus.org',
],
'threshold' => 1, // Number of matches to block
App\Services\EmailService or middleware (e.g., CheckDNSBeforeSending).
use Palpalani\DNSCheck\DNSCheck;
$check = new DNSCheck(config('dns-deny-list.blacklists'));
if ($check->isBlacklisted($senderIp)) {
throw new \Exception("IP blacklisted. Aborting send.");
}
DenyListCheckJob::dispatch($senderIp)->onQueue('email-validation');
php-dns lacks IPv6 support.config/).palpalani/laravel-dns-deny-list-check and php-dns.composer.json to avoid breaking changes.dig +short TXT 127.0.0.2.zen.spamhaus.org
$cacheKey = "dns_blacklist_{$ip}";
$isBlacklisted = cache()->remember($cacheKey, now()->addMinutes(15), fn() =>
$check->isBlacklisted($ip)
);
| Failure Scenario | Impact | Mitigation |
|---|---|---|
| DNS Resolution Failures | Email sends blocked | Fallback to allowlist or skip checks |
| All Blacklists Unreachable | False negatives (spam risk) | Use a default "pass" or whitelist trusted IPs |
| False Positives | Legitimate emails blocked | Manual review workflow or allowlist exceptions |
| Package Abandonment | No updates/maintenance | Fork or replace with alternative (e.g., spamhaus/ip-check) |
| IPv6 Incompatibility | Checks fail for IPv6 senders | Custom DNS resolver or IPv6-specific config |
How can I help you explore Laravel packages today?