Open-Source Laravel Package

Fraud Protection for Laravel

The package checks each sign-up and form submission for fraud before it reaches your controller, and gives each one a risk score from 200 (low risk) to 1,000 (high risk). You decide what happens next.

  • One route middleware or one validation rule checks each submission before it reaches your controller.
  • Starts in monitor mode. You choose whether, and from which risk level, submissions are rejected.
  • Visitors see what they can fix, such as a suggested email correction, never a score.

14-day free trial · No credit card required · Accessible pricing

Install with Composer as opportify/laravel. Laravel 12 on PHP 8.2 or later, Laravel 13 on PHP 8.3 or later.

Opportify
Laravel
Risk score
200 (low risk) to 1,000 (high risk)
Laravel native
Middleware, rules, facade, events
Fails open
If the API is unreachable, submissions continue

You decide what happens next

Monitor

The default: each risk score is logged and nothing is rejected.

Reject

From the risk level you choose, with a normal Laravel validation error.

How It Works in Laravel

Install the package, add your API key and check your sign-up route. Each submission gets a risk score, and you decide what happens next.
  1. Install the package

    Run composer require opportify/laravel. The service provider and the Opportify facade register automatically.
  2. Add your API key

    Put your key in .env as OPPORTIFY_API_KEY. Without a key, checks are skipped and every submission continues.
  3. Check your sign-up route

    Add opportify.check:registration to the route, or the opportify_fraud rule to the email field of your form request.
  4. Review, then decide

    Start in monitor mode and review the log. When you are ready, set OPPORTIFY_FRAUD_MODE=block and the risk level that suits your app.

Install With Composer

From your Laravel project directory:
composer require opportify/laravel
php artisan vendor:publish --tag=opportify-config  # optional

Then add OPPORTIFY_API_KEY to .env. The package documentation covers every setting, the field map and the messages.

Middleware, Rules or Facade

Pick the one that fits your code. All three fail open and use the same risk level settings.

Route middleware

Checks the submission before your controller runs. The second parameter sets monitor or block for that route.

Route::post('/register', [RegisteredUserController::class, 'store'])
    ->middleware('opportify.check:registration');

Route::post('/contact', ContactController::class)
    ->middleware('opportify.check:contactForm,block');

Validation rules

Use opportify_fraud for the whole submission, or opportify_email to check only the address with Email Insights.

use Opportify\Laravel\Rules\OpportifyFraud;

'email' => ['required', 'email', new OpportifyFraud('registration')],

// or as a string rule
'email' => 'required|email|opportify_fraud:registration',

Facade

For custom flows. check() never throws, and the decision holds the score, level and factors.

use Opportify\Laravel\Facades\Opportify;

$fraud = Opportify::fraud();
$check = $fraud->createRequest($request, 'leadCapture');
$check->email = $request->input('work_email');

$decision = $fraud->check($check);
$decision->result?->score; // 200 to 1000

What You Can Check for Fraud

Pass the submission type to the middleware or rule, so the score fits the form.

Submission types you can check

  • registrationSign-ups (the default)
  • trialFree trial requests
  • contactFormContact forms
  • leadCaptureLead and demo forms
  • subscriptionNewsletter and list sign-ups
  • supportSupport requests
  • checkoutOrders

Requirements

  • PHP 8.2 or later
  • Laravel 12 or 13Laravel 13 needs PHP 8.3
  • An Opportify account and API key
  • Works withFortify, starter kits that register users in their own routes, and your own forms

What You Get in the Package

Everything in the current release, version 0.1.

Monitor or reject

Monitor mode logs each check and rejects nothing. Set OPPORTIFY_FRAUD_MODE=block and a risk level, from lowest to highest, or choose per route. Rejected submissions get a normal Laravel validation error, so Blade, Inertia and JSON requests all work.

A specific message for each situation

A rejected visitor sees the most specific message: a suggested email correction, an invalid, disposable, no-reply or undeliverable address, a shared inbox, a connection problem at high risk, or a generic message. Every message is translatable, and none shows the score. See the implementation guide.

Help visitors fix email problems

Optional, off by default. With OPPORTIFY_GUIDE_EMAIL=true, a likely typo or a disposable, no-reply or undeliverable address gets its message even below your risk level, so real visitors can correct it.

Optional Browser Signals

Off by default. Add <x-opportify::browser-signals /> to your layout and the script's token is sent with each check, so the score can include how visitors use your forms. This is Full Signal: the Fraud Protection API and the JS script together. The script never submits your forms. Update your privacy notice first, see Cookies and Browser Storage and Content Security Policy.

In-flight email validation

Optional, off by default, and needs Browser Signals. The script checks email fields as visitors type and suggests fixes. Each check uses Email Insights credits, and the typed address is sent to us before submit. How it works.

Request Context

Each check includes the visitor's user agent, accepted languages, referrer (scheme, host and path only) and client hints, which help tell scripts apart from browsers. Learn more.

Events

CheckingSubmission, SubmissionChecked, SubmissionFlagged, SubmissionBlocked and CheckFailed, so you can store the score or hold flagged accounts for review.

Email Insights and IP Insights

Opportify::email() and Opportify::ip() for when you only need one signal, with results cached under hashed keys.

Octane, queues and tests

Scoped services that are safe under Octane and in queue workers. Fraud Protection calls use Laravel's HTTP client, so Http::fake() and Telescope see them.

Data, Privacy and Control

Each check sends one HTTPS request with the visitor's IP address, Request Context, the Browser Signals token when enabled, and only the fields in your field map. Passwords and unmapped fields are never sent.

Log lines hold the outcome, risk level, score, factor codes and submission type only. Personal data and the API key are never logged.

Tell your visitors that submissions are checked by a third party. See our Privacy Policy.

Resources and support

Open-source Laravel package

Check Laravel sign-ups for fraud

Install the package, add your API key, and give every sign-up and form submission a risk score. You decide what happens next.

  • Risk score from 200 to 1,000 with the main factors
  • Monitor first, reject when you are ready

Laravel package FAQ

How do I install the Laravel package?

Run composer require opportify/laravel in your project and add OPPORTIFY_API_KEY to .env. The service provider and the Opportify facade register automatically.

What do I need to use it?

PHP 8.2 or later, Laravel 12 or 13 (Laravel 13 needs PHP 8.3), and an Opportify API key. The package is open source under the MIT license. Fraud Protection is a paid Opportify service: 14-day free trial · No credit card required · Accessible pricing. See pricing.

Does it reject anything out of the box?

No. It starts in monitor mode: each submission is checked for fraud and its risk score is logged, and nothing is rejected. You choose whether, and from which risk level, submissions are rejected, for the whole app or per route.

Middleware or validation rule: which should I use?

Use the opportify.check middleware on the routes that receive submissions. Use the opportify_fraud rule where you already validate, for example in a form request or in Fortify's CreateNewUser action. When both run on one request, the rule reuses the middleware's result and makes no second API call.

What do visitors see when a submission is rejected?

A normal Laravel validation error with the most specific message that applies, such as "Did you mean jane@gmail.com? Please confirm your email address." for a likely typo. You can publish and translate every message, and none shows the risk score, level or factors.

What happens if the API is unavailable?

The package fails open. A missing key, a timeout or an API error lets the submission through. The timeout defaults to three seconds and is set with OPPORTIFY_TIMEOUT.

What data is sent to Opportify?

The visitor's IP address, Request Context, the Browser Signals token when enabled, and only the fields you map, such as email, name and company. Fields that are not in the map, such as passwords, are never sent. Log lines hold the outcome, risk level, score and factor codes only. See our Privacy Policy.

Does it work with Livewire and Inertia?

Inertia and JSON requests work with the middleware and rules. For Full Signal on forms that post JSON, include the script's two hidden inputs in the request body. Livewire support is planned for a later release. See the package documentation.