Laravel 11 Custom Validation Rule Email Verification Guide
Add real-time email verification and disposable-email blocking to Laravel 11 Custom Validation Rule with the VeriShield Edge API. The snippet below gates a signup and returns the canonical email identity.
Language
PHP 8.3
Ecosystem
Composer / Symfony
Latency
< 85ms
Install
Shell
composer require guzzlehttp/guzzleVerification code
PHP 8.3
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Support\Facades\Http;
class VeriShieldEmailRule implements ValidationRule {
public function validate(string $attribute, mixed $value, Closure $fail): void {
$response = Http::withHeaders(['X-RapidAPI-Key' => config('services.rapidapi.key')])
->post('https://verishield-edge-api.p.rapidapi.com/v1/verify', ['email' => $value]);
if ($response->json('fraud_risk.recommendation') === 'BLOCK') {
$fail('Disposable or high-risk email addresses are not permitted.');
}
}
}What this protects against
Disposable and temporary inboxes, Gmail dot-trick and plus-alias multi-accounting, high-entropy bot usernames, and freshly registered fraud domains. The API returns a 0-100 fraud score with an ALLOW, CHALLENGE_2FA or BLOCK recommendation.