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.
- 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
Runcomposer require opportify/laravel. The service provider and theOpportifyfacade register automatically.Add your API key
Put your key in.envasOPPORTIFY_API_KEY. Without a key, checks are skipped and every submission continues.Check your sign-up route
Addopportify.check:registrationto the route, or theopportify_fraudrule to the email field of your form request.Review, then decide
Start in monitor mode and review the log. When you are ready, setOPPORTIFY_FRAUD_MODE=blockand the risk level that suits your app.
Install With Composer
composer require opportify/laravel
php artisan vendor:publish --tag=opportify-config # optionalThen 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 1000What You Can Check for Fraud
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
Monitor or reject
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
Help visitors fix email problems
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
<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
Request Context
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
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
- Package documentation
Configuration, middleware, rules, facade, messages, Full Signal, recipes, events and testing.
- Package on Packagist
Install with Composer as opportify/laravel.
- Source on GitHub
Open source under the MIT license.
- Changelog
What changed in each release.
- Fraud Protection API reference
The risk score, risk level and factors the package receives.
- Contact us
Help with setup and rollout.
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?
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?
Does it reject anything out of the box?
Middleware or validation rule: which should I use?
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?
What happens if the API is unavailable?
OPPORTIFY_TIMEOUT.