All Integrations

Laravel integration

Block disposable emails in Laravel

You're running a Laravel app and fake signups keep getting through. Add one call to your registration flow, or drop it in as middleware, and Fidro checks every email and IP before the account exists.

How it works

Laravel's Http client is all you need. Call Fidro from a service, a form request or a middleware, then act on the answer: allow, challenge or block. Send event and user_id as well and Fidro remembers, so the fifth signup from one IP this hour gets noticed.

One fake signup can look perfectly normal. Five from the same IP in an hour don't. Send event and user_id with each call and Fidro remembers, so it catches the pattern as well as the person. You get a score from 0 to 100 and one answer: allow, challenge or block.

1. Install what you need

# Nothing to install: Laravel's HTTP client covers it

You'll also need an API key. Sign up free and you'll have one in a minute, no card needed.

2. Check every signup

Send the email and IP to POST /api/validate. Fidro checks for disposable domains, missing mail servers, VPNs, proxies and Tor, and answers allow, challenge or block. Let the allows straight in, ask the challenges to confirm their email, and turn the blocks away.

<?php

use Illuminate\Support\Facades\Http;

// In a service, action or controller
function checkSignup(string $email, string $ip): array
{
    return Http::withToken(config('services.fidro.api_key'))
        ->timeout(5)
        ->post('https://fidro.io/api/validate', [
            'email' => $email,
            'ip'    => $ip,
            'event' => 'signup',
        ])
        ->throw() // Throws on 4xx and 5xx
        ->json();
}

// ----- Or as middleware -----
// app/Http/Middleware/FidroFraudCheck.php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;

class FidroFraudCheck
{
    public function handle(Request $request, Closure $next)
    {
        if ($request->filled('email')) {
            $response = Http::withToken(config('services.fidro.api_key'))
                ->timeout(5)
                ->post('https://fidro.io/api/validate', [
                    'email' => $request->input('email'),
                    'ip'    => $request->ip(),
                    'event' => 'signup',
                ]);

            // Fail open: an outage on our side should never block your users
            if ($response->successful()) {
                if ($response->json('recommendation') === 'block') {
                    abort(403, 'This signup has been flagged as high risk.');
                }

                $request->merge(['fidro_risk_score' => $response->json('risk_score')]);
            }
        }

        return $next($request);
    }
}

3. Look up an IP

Just want to know where a request came from? GET /api/ip/{ip} returns the country, city, ISP and network, without scoring. The VPN, proxy and Tor flags come from /api/validate, under data.checks.

<?php

use Illuminate\Support\Facades\Http;

function lookupIp(string $ip): array
{
    return Http::withToken(config('services.fidro.api_key'))
        ->timeout(5)
        ->get("https://fidro.io/api/ip/{$ip}")
        ->throw()
        ->json();
}

// Usage
$result = lookupIp(request()->ip());

logger()->info('Fidro IP lookup', [
    'country' => $result['location']['country_name'] ?? null,
    'isp'     => $result['location']['isp'] ?? null,
]);

// VPN, proxy and Tor flags come from /api/validate, under data.checks

Want to see real results first? Try any address in the free IP checker.

Next steps

The API reference has every field. The free checker shows you real results. And if you're weighing up alternatives, the comparisons are honest about where others fit.

Frequently Asked Questions

How do I add fraud detection to Laravel?
Call https://fidro.io/api/validate with Laravel's Http facade, passing the user's email and IP. Fidro returns a risk score from 0 to 100 and one recommendation: allow, challenge or block. It takes a few minutes, and you can run it as middleware so every signup is checked automatically.
Does Fidro have a Laravel SDK?
You don't need one. Fidro is a plain REST API, and the Http facade that ships with every Laravel app handles it: Http::withToken($key)->post(...). No extra Composer packages.
Is Fidro free to use with Laravel?
Yes. The free plan covers 200 validations a month with no credit card, and it works in any Laravel app, as a service, an action or middleware.
What should I do when Fidro says challenge?
Ask for something a real person will happily do and a script won't: confirm the email address, solve a CAPTCHA, or wait for a quick manual review. Save outright blocks for the clear cases.

Start catching bad signups in the next 5 minutes

Create your account, grab your API key, and send your first request. Free plan with 200 validations/month. No credit card. Cancel anytime.