opportify / craft-fraud-protection
Opportify Fraud Protection for Craft CMS: risk scoring for user registrations, Craft Commerce checkouts, and Formie, Freeform, Wheel Form and Contact Form submissions.
Package info
github.com/opportify/craft-fraud-protection
Type:craft-plugin
pkg:composer/opportify/craft-fraud-protection
Requires
- php: ^8.2
- craftcms/cms: ^5.0.0
Requires (Dev)
- craftcms/commerce: ^5.0
- craftcms/contact-form: ^3.0
- craftcms/phpstan: dev-main
- laravel/pint: ^1.18
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
- solspace/craft-freeform: ^5.0
- verbb/formie: ^3.0 || ^4.0
- xpertbot/craft-wheelform: ^4.0
Suggests
- craftcms/commerce: Screen Craft Commerce checkouts with Fraud Protection.
- craftcms/contact-form: Screen Contact Form submissions with Fraud Protection.
- solspace/craft-freeform: Screen Freeform submissions with Fraud Protection.
- verbb/formie: Screen Formie submissions with the Opportify Fraud Protection captcha integration.
- xpertbot/craft-wheelform: Screen Wheel Form submissions with Fraud Protection.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-02 13:22:46 UTC
README
Opportify Fraud Protection for Craft CMS
Table of Contents
- Overview
- Screenshots
- Requirements
- Getting Started
- What Gets Checked for Fraud
- Browser Signals
- Monitor and Block Modes
- Messages
- Data Sent to Opportify
- Handling Errors
- Logs
- Events
- Development
- Releasing
- Support
- License
Overview
This plugin connects Craft CMS to Opportify Fraud Protection. Opportify analyzes 100+ signals, including email, IP, content, session and velocity, to check each sign-up, form and order for fraud. Each one gets a risk score from 200 (low risk) to 1000 (high risk), a risk level (lowest, low, medium, high, highest) and the factors that contributed to it.
The risk score is advisory, and you decide what happens next. Out of the box the plugin only checks and logs submissions; you decide whether, and from which risk level, submissions are blocked.
This plugin uses Fraud Protection only. Email Insights and IP Insights are also available as standalone APIs when you only need one signal.
| Source | What happens when a submission is blocked |
|---|---|
| Front-end user registration | The user is not created; the email field shows the matching message |
| Formie forms | Email problems are shown on the Email field; other blocks are handled as Formie spam |
| Contact Form | Email problems are shown on the email field; other blocks are not sent (Contact Form's spam handling) |
| Freeform forms | The submission is not saved; email problems are shown on the email field, other messages as a form error |
| Wheel Form forms | The message is not saved or emailed; email problems are shown on the email field, other messages as a form error |
| Craft Commerce checkouts | Off by default (its own setting). The payment is stopped before the gateway is called; the customer sees the matching message |
| Your own forms | You decide, using the plugin's PHP API |
Sign up for Opportify to get an API key.
Screenshots
Choose what to check for fraud:
A specific message for each email problem, shown on the email field so the visitor can fix it:
Every Commerce order gets a risk score, with the top factors in plain language:
More in docs/plugin-store/screenshots/.
Requirements
- Craft CMS 5.0 or later (Craft 5 requires PHP 8.2+)
- PHP 8.2 or later
- An Opportify API key
- Optional: Formie 3 or 4 (tested with Formie 4.2), Contact Form 3, Freeform 5, Wheel Form 4, Craft Commerce 5
Craft CMS 6 is in beta and will be supported by a later major version of this plugin.
Getting Started
Installation
From the Craft control panel: go to Plugin Store, search for “Opportify Fraud Protection” and choose Install.
Or with Composer, from your project directory:
composer require opportify/craft-fraud-protection php craft plugin/install opportify-fraud-protection
Configuration
-
Add your API key to the project's
.envfile:OPPORTIFY_API_KEY="your-api-key" -
In the control panel, go to Settings → Plugins → Opportify Fraud Protection and enter
$OPPORTIFY_API_KEYin the API Key field. Using an environment variable keeps the key out of project config and out of version control. -
Choose what to check for fraud, the Risk level and whether to Block risky submissions.
Every setting can also be set in config/opportify-fraud-protection.php, which overrides the control panel and can differ per environment:
<?php use craft\helpers\App; return [ 'apiKey' => App::env('OPPORTIFY_API_KEY'), 'screenRegistrations' => true, 'screenContactForm' => true, 'screenFreeform' => true, 'screenWheelForm' => true, 'screenCommerceCheckouts' => true, 'blockingEnabled' => App::env('CRAFT_ENVIRONMENT') === 'production', 'blockCommerceCheckouts' => false, 'riskThreshold' => 'highest', // lowest, low, medium, high or highest 'helpFixEmail' => false, 'helpFixRoleAddress' => false, 'blockedMessage' => "We couldn't verify some of the details you entered. Please check them and try again.", 'emailCorrectionMessage' => 'Did you mean {suggestion}? Please confirm your email address.', // ... and the other messages listed under "Messages". 'timeout' => 3.0, // seconds, 1 to 10 'logResults' => true, 'browserSignalsEnabled' => false, 'browserSignalsPublicKey' => App::env('OPPORTIFY_PUBLIC_KEY') ?? '', 'emailValidationEnabled' => false, ];
| Setting | Default | Description |
|---|---|---|
apiKey |
none | Your Opportify API key, or an environment variable reference such as $OPPORTIFY_API_KEY. |
screenRegistrations |
true |
Check new front-end sign-ups for fraud. |
screenContactForm |
true |
Check Contact Form messages for fraud. |
screenFreeform |
true |
Check Freeform submissions for fraud. |
screenWheelForm |
true |
Check Wheel Form submissions for fraud. |
screenCommerceCheckouts |
true |
Check Craft Commerce orders for fraud at checkout. |
blockingEnabled |
false |
Block registrations and form submissions at or above riskThreshold. When off, they are only flagged in the log. Does not apply to Commerce checkouts. |
blockCommerceCheckouts |
false |
Stop Commerce payments at or above riskThreshold. When off, checkouts are only scored and the result is recorded on the order. |
riskThreshold |
highest |
Lowest risk level that is flagged or blocked. |
helpFixEmail |
false |
Help visitors fix email problems: stop a submission whose email address has a suggested correction, an invalid format, or is disposable, no-reply or undeliverable, and show the email message, even below riskThreshold. See Help Visitors Fix Email Problems. |
helpFixRoleAddress |
false |
With helpFixEmail, also ask for a personal address instead of a shared inbox such as info@. |
blockedMessage |
see Messages | The generic message, used when no more specific message applies. Sites that saved their own text keep it. Translatable in the site category. |
emailCorrectionMessage, emailInvalidMessage, emailDisposableMessage, emailNoReplyMessage, emailUndeliverableMessage, emailRoleMessage, networkHighRiskMessage, networkBlocklistedMessage, networkUnverifiedMessage |
see Messages | The message for each situation. Translatable in the site category. |
timeout |
3.0 |
Seconds to wait for the API before letting the submission through. |
logResults |
true |
Write one line per check to the plugin's log file. |
browserSignalsEnabled |
false |
Load the Opportify browser script on front-end pages. Accepts true, false or an environment variable reference. See Browser Signals. |
browserSignalsPublicKey |
none | Your Opportify public key (starts with pk_), or an environment variable reference such as $OPPORTIFY_PUBLIC_KEY. |
emailValidationEnabled |
false |
In-flight email validation: the browser script checks email fields as visitors type. Works only while browser signals are on. Each check uses Email Insights credits. Accepts true, false or an environment variable reference. See In-Flight Email Validation. |
What Gets Checked for Fraud
User Registrations
New accounts created by guests through Craft's front-end registration form (the users/save-user action) are checked for fraud before the user is saved, with submissionType registration. The plugin sends the email address, first and last name, username (when it differs from the email) and the visitor's IP address.
Users created in the control panel, from the console or by other plugins are not checked.
Formie
The plugin adds an Opportify Fraud Protection captcha integration to Formie. It does not show anything to visitors; it reads the submitted fields on the server.
- Go to Formie → Settings → Captchas and enable Opportify Fraud Protection.
- Edit a form, open its Settings → Spam tab and turn it on for that form.
Fields are matched by type: the first Email, Name, Phone, Address and Multi-line Text fields (a second Phone field is sent as phone2), plus Single-line Text fields with one of the handles listed below. Submissions are sent with submissionType contactForm. When the message for a blocked submission is about the email address, it is shown on the Email field when Formie validates the submission, so the visitor can fix it. Any other blocked submission is handled like any other Formie spam submission, following your Formie spam settings.
Contact Form
When the Contact Form plugin is installed, its messages are checked for fraud with submissionType contactForm (sender email, name, subject and message) after Contact Form validates them. When the message for a blocked submission is about the email address, it is added as a validation error on the fromEmail field, so the visitor can fix it. Any other blocked submission is marked as spam on Contact Form's beforeSend event: the email is not sent and the visitor sees the normal success message.
Freeform
When Freeform 5 is installed, its submissions are checked for fraud with submissionType contactForm. The check runs on Freeform's form afterValidate event, after Freeform has validated the last page of the form and before the submission is saved, so incomplete or invalid submissions are not sent. Turn it off with the Freeform submissions setting.
Fields are matched by type: the first Email, Phone (a second one is sent as phone2), Textarea and Website fields, plus Text fields with one of the handles listed below. When blocking is on, a blocked submission is not saved: an email message is shown on the Email field, any other message as a form error.
Wheel Form
When Wheel Form 4 is installed, its submissions are checked for fraud with submissionType contactForm. The check runs on Wheel Form's afterValidate event, after Wheel Form has validated the posted values and before the message is saved or emailed. Turn it off with the Wheel Form submissions setting.
Fields are matched by type: the first Email, Telephone (a second one is sent as phone2) and Textarea fields, plus Text fields with one of the handles listed below. When blocking is on, a blocked submission is not saved or emailed. Wheel Form returns an email message under the email field's name and any other message under the form error key, like its other errors.
Field Handles
Formie Single-line Text, Freeform Text and Wheel Form Text fields are sent when their handle (Wheel Form: field name) is one of these, ignoring case:
| Handle | Sent as |
|---|---|
subject |
subject |
company, companyName, organization |
companyName |
website, url |
website |
username |
username |
firstName, lastName |
firstName, lastName |
name, fullName |
fullName |
address, address1, address2 |
address1, address2 |
city |
city |
state, region, province |
region |
zip, zipCode, postcode, postalCode |
postalCode |
country |
country |
Craft Commerce
When Craft Commerce 5 is installed, orders are checked for fraud at checkout with submissionType checkout. Turn it off with the Orders at checkout setting.
The check runs when the customer submits payment (commerce/payments/pay), on the payments service's beforeProcessPaymentEvent event. Commerce triggers it after it has validated and recalculated the cart and before it calls the payment gateway, so a blocked checkout is never charged and the order stays a cart. The plugin sends the order's email address, the visitor's IP address, Request Context and browser signals from the payment request, and these billing address fields: first, last and full name, organization (companyName), address lines 1 and 2, city (locality), region (administrativeArea), country code and postal code. Craft addresses have no phone attribute; if your address field layout has a custom field with the handle phone, phoneNumber or telephone, it is sent as phone1.
Checkouts are in monitor mode by default, even when Block risky submissions is on: the result is recorded and the payment continues. Turn on Block risky orders to stop payments at or above the risk level. Commerce then shows the matching message as the payment error and the customer can review the cart.
The latest result of each order (outcome, risk level, score and top factor codes, no personal data) is stored in the plugin's own table and shown in the Fraud Protection panel of the order's page in the control panel. A declined and retried payment is checked again and replaces the earlier result.
Not checked:
- Orders created or paid in the control panel, from the console or while an admin impersonates a customer, because there is no visitor to score.
- Payments towards an order that is already complete, such as a later partial payment.
Stores that allow checkout without payment (commerce/cart/complete) are checked when the order is completed, but only in monitor mode: Commerce has no event that can stop that completion, so the result is recorded on the order and the order is completed.
Your Own Forms
Check any other form for fraud from a module or plugin:
use opportify\fraudprotection\Plugin; use opportify\fraudprotection\screening\SubmissionType; $screening = Plugin::getInstance()->getScreening(); // Fills in the visitor's IP address, Request Context and, when the form // posted them, the browser script's fields from the current request. $request = $screening->createRequest(SubmissionType::LeadCapture); $request->email = $email; $request->fullName = $name; $request->message = $message; // Optional: up to 20 extra string fields, sent as formData. $request->formData = ['referral_code' => $code]; $decision = $screening->screen($request, 'my-form'); if ($decision->isBlocked()) { // The most specific message for the visitor. Show it on the email // field when isEmailMessage() is true, otherwise as a form error. $message = $screening->getMessage($decision); $onEmailField = $screening->isEmailMessage($decision); } // $decision->outcome: allowed, flagged, blocked, skipped or error // $decision->situation: why a blocked submission was stopped, such as Situation::EmailDisposable // $decision->result?->score, $decision->result?->level, $decision->result?->factors // $decision->result?->email and ->ip: the email and IP signals the messages are based on
formData is shared with the Request Context keys, which take priority: extra fields are sent only while the total stays within the API's limit of 20 keys, and values are shortened to 512 characters.
screen() takes an optional third argument, blockingEnabled, to decide for one form whether a result at or above the risk level blocks it; by default the Block risky submissions setting decides. Pass false as the fourth argument, canStop, when you only record the result, so Help visitors fix email problems never reports a block.
SubmissionType has the documented values registration, trial, contactForm, checkout, leadCapture, subscription and support.
Browser Signals
Browser signals are off by default. When you turn them on, the plugin loads the Opportify Fraud Protection script on your front-end pages. The script observes how visitors interact with your forms, such as typing, pointer movement and timing, and checks for automation tools. It adds two hidden fields to every form, opportifyToken and opportifyFormUUID. When a sign-up, form submission or Commerce payment is checked, the plugin forwards them so the score can include these signals. Payment forms that a gateway's JavaScript submits for you may not post these fields; those checkouts are checked without them.
The plugin loads the script with submit interception turned off, so it never submits or changes your forms:
<script src="https://cdn.opportify.ai/f/v1.6.0.min.js" data-opportify-key="pk_..." data-opty-intercept="disabled" async></script>
The script URL comes from https://cdn.opportify.ai/f/latest.json, cached for two hours. The plugin uses it only when it is an https://cdn.opportify.ai/f/v<version>.min.js URL of version 1.4.0 or later; otherwise, or when the file cannot be read within two seconds, it uses the pinned v1.6.0 and tries again after ten minutes.
It is registered through Craft's View API on front-end page requests only. Control panel pages, previews and console requests do not load it. If the token is missing, for example because the script was blocked or the visitor has JavaScript turned off, the submission is checked without it as before.
Setup
- In the Opportify dashboard, copy your public key (it starts with
pk_). - Add your site's domain to the allowed domains in the Opportify dashboard. The script only works on allowed domains. Add every hostname visitors use, such as
example.comandwww.example.com. - Add the public key to
.env, for exampleOPPORTIFY_PUBLIC_KEY="pk_...". - In Settings → Plugins → Opportify Fraud Protection → Browser signals, set Enable browser signals to Yes and enter
$OPPORTIFY_PUBLIC_KEYas the Public key. The public key is not a secret, but an environment variable makes it easy to use a test key outside production. The enable setting accepts an environment variable too. - Check that your front-end templates output
{% head %}or a</head>tag (Craft adds the script there), then load a page with a form and confirm in your browser's developer tools that the script loads and the form contains theopportifyTokenfield.
In-Flight Email Validation
Off by default. With browser signals on, turn on In-flight email validation (emailValidationEnabled) and the script checks email fields as visitors type, before they submit. It adds the data-opty-email-validation attribute to the script tag; see the email validation guide.
After a pause in typing, the script shows a hint under the field when the address:
- looks mistyped: a clickable “Did you mean …?” suggestion that fills in the correction
- has an invalid format
- cannot receive mail
- is a disposable address
- is high risk: a neutral “please double-check” prompt
A valid address shows nothing. The hints never stop a submission; the server-side check still decides.
- Credits: each check uses your Email Insights credits, not Fraud Protection credits.
- Privacy: the typed email address is sent to Opportify before the form is submitted. Say so in your privacy notice.
- Opt a form out with
data-opty-email-validation="off"on its<form>tag. - The setting is unavailable while browser signals are off, because the script runs the validation.
Privacy notice
The script observes form interaction, such as typing and pointer movement, to detect bots and fraud. With in-flight email validation on, it also sends the typed email address to Opportify for checking before the form is submitted. Update your privacy notice to tell visitors about this before you turn browser signals on, and follow your consent requirements. See the Opportify Privacy Policy.
Content Security Policy
If your site sends a Content Security Policy, add these sources to your existing directives:
script-src https://cdn.opportify.ai; connect-src https://api.opportify.ai https://form.opportify.ai; frame-src https://cdn.opportify.ai;
See the Content Security Policy guide for details.
Monitor and Block Modes
| Mode | Result below the risk level | Result at or above the risk level |
|---|---|---|
| Monitor (default) | Allowed | Allowed and logged as flagged |
| Block | Allowed | Blocked and logged as blocked |
Start in monitor mode, review the log for a while, then turn on blocking at the level that suits your site.
Messages
When the plugin stops a sign-up, form or payment, the visitor sees the most specific message, following the order of the Fraud Protection implementation guide:
| Order | Situation | Read from the API response | Setting | Default text |
|---|---|---|---|---|
| 1 | A correction is available | sources.email.emailCorrection |
emailCorrectionMessage |
Did you mean {suggestion}? Please confirm your email address. |
| 2 | Invalid format | sources.email.isFormatValid is false |
emailInvalidMessage |
The email address provided does not look valid. Please review it. |
| 3 | Disposable address | sources.email.emailType is disposable |
emailDisposableMessage |
Temporary or disposable email addresses are not accepted. Please use a permanent email address. |
| 4 | No-reply address | sources.email.addressSignals.isNoReply |
emailNoReplyMessage |
This address cannot receive replies. Please use an email address you can check. |
| 5 | Undeliverable | sources.email.isDeliverable is "no" |
emailUndeliverableMessage |
We could not confirm this email address with the provider. Could you double-check it? |
| 6 | Shared inbox | sources.email.addressSignals.isRoleAddress |
emailRoleMessage |
This looks like a shared inbox. For your account, please use a personal email address. |
| 7 | Tor or open proxy (high and highest risk only) | sources.ip.connectionType |
networkHighRiskMessage |
The connection you are using was flagged as high risk. Please switch to your regular internet connection to continue. |
| 7 | Blocklisted IP (high and highest risk only) | sources.ip.blocklisted.isBlockListed |
networkBlocklistedMessage |
Your connection was flagged for suspicious activity. Please try a different network or contact support. |
| 7 | VPN or cloud provider (high and highest risk only) | sources.ip.connectionType |
networkUnverifiedMessage |
We could not verify your connection. Please try again from a standard home or office network. |
| 8 | Anything else | blockedMessage |
We couldn't verify some of the details you entered. Please check them and try again. |
- Email messages are shown on the email field where the form supports field errors; network messages and the generic message are form-level. Craft registrations have no form-level error, so every message is shown on the email field there.
- Messages never show the score, the risk level or factor codes. Every signal may be missing; a missing signal never matches.
- Email messages are used only for front-end visitor submissions, never for control panel, console, API or imported submissions.
- Each message is editable in the settings and translatable through Craft's static message translations in the
sitecategory.{suggestion}is replaced with the suggested address. - Upgrading from 1.0: Blocked message is now Generic message. If you saved the plugin settings in the control panel, your saved text is kept.
Help Visitors Fix Email Problems
Off by default (helpFixEmail). With it off, nothing changes: the plugin stops only submissions at or above the risk level, now with the specific message.
With it on, a front-end submission whose email address has a suggested correction, an invalid format, or is disposable, no-reply or undeliverable is stopped with the email message even below the risk level, as the implementation guide recommends, so the visitor can fix a typo before it costs you a lead or an order confirmation. Turn on Also ask for a personal address instead of a shared inbox (helpFixRoleAddress) to include shared inboxes such as info@. This applies to every integration that can stop a submission, including Commerce payments, and is logged with reason=email_guidance.
Data Sent to Opportify
Each check sends one HTTPS request to https://api.opportify.ai/intel/v1/fraud/analyze with your API key in the x-opportify-token header. The JSON body contains only the fields available for that submission:
| Field | Registration | Formie | Contact Form | Freeform, Wheel Form | Commerce |
|---|---|---|---|---|---|
email |
✓ | ✓ | ✓ | ✓ | ✓ |
userIp (visitor IP, as resolved by Craft) |
✓ | ✓ | ✓ | ✓ | ✓ |
firstName, lastName |
✓ | ✓ | ✓ | ✓ | |
fullName |
✓ | ✓ | ✓ | ✓ | |
username |
✓ | ✓ | ✓ | ||
phone1, companyName, address1, address2, city, region, country, postalCode |
✓ | ✓ | ✓ | ||
phone2, website |
✓ | ✓ | |||
subject, message |
✓ | ✓ | ✓ | ||
formData with the Request Context |
✓ | ✓ | ✓ | ✓ | ✓ |
opportifyToken, opportifyFormUUID, origin (with browser signals) |
✓ | ✓ | ✓ | ✓ | ✓ |
submissionType |
registration |
contactForm |
contactForm |
contactForm |
checkout |
Form fields are sent only when the form has a matching field (see Field Handles); Commerce fields only when the billing address has them.
Empty values are not sent, long values are shortened, and nothing is sent in the URL. opportifyToken and opportifyFormUUID are the hidden fields the browser script adds to the form; they are sent together with origin, the hostname of the page the form was submitted from (taken from the browser's Origin header, or the current site's URL when the browser sends none), and only when all three are present. The API checks the token only when it gets all three.
The visitor IP comes from Craft's request handling; if your site is behind a proxy or CDN, configure Craft's ipHeaders setting so the real visitor IP is used.
Request Context
For submissions made on the front end, the plugin also sends the visitor's request headers in formData, following the Request Context standard. They help detect requests made by scripts rather than browsers, even without the browser script.
formData key |
From the visitor's header |
|---|---|
user_agent |
User-Agent |
accept_language |
Accept-Language |
referer |
Referer, reduced to scheme, host and path (the query string and fragment are removed) |
sec_ch_ua |
Sec-CH-UA |
sec_ch_ua_platform |
Sec-CH-UA-Platform |
sec_ch_ua_mobile |
Sec-CH-UA-Mobile |
A key is sent only when the header is present and not empty, and values are shortened to 512 characters. The IP address stays in userIp. Requests from the control panel, the console, or an admin impersonating a user send no visitor IP, Request Context or browser fields, because they describe the person acting rather than the visitor. You can remove any of these keys in a beforeScreen listener through $event->request->requestContext.
You are responsible for telling visitors that their submissions are checked for fraud by a third party, for example in your privacy policy. See the Opportify Privacy Policy and API documentation for how the data is processed.
Handling Errors
The plugin fails open: if the API key is missing, the API cannot be reached within the timeout, or it returns an error, the submission continues as if the plugin were not installed. API errors are logged as warnings with the HTTP status and the API's errorCode, for example:
Fraud Protection API error: the rate limit was exceeded (HTTP 429, errorCode TOO_MANY_REQUESTS). The submission was allowed.
| Status | Meaning |
|---|---|
| 400 | The request was rejected as invalid |
| 402 | The plan quota is exhausted |
| 403 | The API key was rejected (errorCode INVALID_TOKEN), or the plan quota is exhausted (errorCode QUOTA_EXCEEDED) |
| 429 | The rate limit was exceeded |
| 5xx | The service is temporarily unavailable |
The Analyze API reference lists 402 for an exhausted quota. In practice the API answers an exhausted quota with HTTP 403 and errorCode QUOTA_EXCEEDED, the same status as an invalid key, so the plugin reads the errorCode first and logs “the plan quota is exhausted” for either status.
Logs
With Log results on, each check writes one line to storage/logs/opportify-fraud-protection-YYYY-MM-DD.log:
Fraud Protection: submissionType=registration outcome=flagged level=highest score=930 factors=email:disposable,ip:datacenter source=registration
Fraud Protection: submissionType=contactForm outcome=blocked level=low score=310 message=email_correction reason=email_guidance source=freeform
Log lines contain the outcome, risk level, score, factor codes and message key only. Email addresses, names, IP addresses, messages and the API key are never logged.
Events
Both events are triggered on opportify\fraudprotection\services\Screening with an opportify\fraudprotection\events\ScreeningEvent:
Screening::EVENT_BEFORE_SCREEN: change$event->requestbefore it is sent (for example to remove a field), or set$event->isValid = falseto skip the check.Screening::EVENT_AFTER_SCREEN: read$event->decision, for example to store the score on your own records, or replace it with your own decision.
$event->source is registration, formie, contact-form, freeform, wheel-form, commerce or the source you passed to screen().
use opportify\fraudprotection\events\ScreeningEvent; use opportify\fraudprotection\services\Screening; use yii\base\Event; Event::on(Screening::class, Screening::EVENT_AFTER_SCREEN, function (ScreeningEvent $event) { if ($event->decision?->result !== null) { // $event->decision->result->score, ->level, ->factors } });
Development
composer install composer test # PHPUnit, no Craft installation needed composer phpstan # PHPStan with Craft's stubs composer lint # Code style (Laravel Pint, PSR-12)
Releasing
Versions follow Semantic Versioning, and the Git tag is the version: composer.json has no version field.
- In a pull request, rename the
## Unreleasedheading inCHANGELOG.mdto## X.Y.Z - YYYY-MM-DD, using the release date. The Craft Plugin Store reads release notes from this heading format. - Merge the pull request. Release Drafter keeps a draft GitHub Release for the next version up to date from the merged pull requests.
- Open the draft release, check that its tag is
vX.Y.Zonmainand matches the changelog heading (the drafter guesses the version from pull request labels, so correct it if needed), then publish it. Publishing creates the tag. The Craft Plugin Store picks up the new tag automatically, and publishing runs the workflow that tells Packagist about the release. Pushes without a release never update Packagist.
Support
- Documentation: opportify.ai/docs
- Issues and feature requests: GitHub Issues
- Email: support@opportify.ai
- Security issues: see SECURITY.md


