MinFraud
extends ServiceClient
in package
This class provides a client API for accessing MaxMind minFraud Score, Insights and Factors.
Usage
The constructor takes your MaxMind account ID and license key. The object
returned is immutable. To build up a request, call the ->with*()
methods.
Each of these returns a new object (a clone of the original) with the
additional data. These can be chained together:
$client = new MinFraud(6, 'LICENSE_KEY');
$score = $client->withDevice(['ip_address' => '1.1.1.1',
'session_age' => 3600.5,
'session_id' => 'foobar',
'accept_language' => 'en-US'])
->withEmail(['domain' => 'maxmind.com'])
->score();
If the request fails, an exception is thrown.
Table of Contents
- VERSION = 'v1.21.0'
- __construct() : mixed
- factors() : Factors
- This method performs a minFraud Factors lookup using the request data in the current object and returns a model object for minFraud Factors.
- insights() : Insights
- This method performs a minFraud Insights lookup using the request data in the current object and returns a model object for minFraud Insights.
- score() : Score
- This method performs a minFraud Score lookup using the request data in the current object and returns a model object for minFraud Score.
- with() : MinFraud
- This returns a `MinFraud` object with the array to be sent to the web service set to `$values`. Existing values will be replaced.
- withAccount() : MinFraud
- This returns a `MinFraud` object with the `account` array set to `$values`. Existing `account` data will be replaced.
- withBilling() : MinFraud
- This returns a `MinFraud` object with the `billing` array set to `$values`. Existing `billing` data will be replaced.
- withCreditCard() : MinFraud
- This returns a `MinFraud` object with the `credit_card` array set to `$values`. Existing `credit_card` data will be replaced.
- withCustomInputs() : MinFraud
- This returns a `MinFraud` object with the `custom_inputs` array set to `$values`. Existing `custom_inputs` data will be replaced.
- withDevice() : MinFraud
- This returns a `MinFraud` object with the `device` array set to `$values`. Existing `device` data will be replaced.
- withEmail() : MinFraud
- This returns a `MinFraud` object with the `email` array set to `$values`. Existing `email` data will be replaced.
- withEvent() : MinFraud
- This returns a `MinFraud` object with the `events` array set to `$values`. Existing `event` data will be replaced.
- withOrder() : MinFraud
- This returns a `MinFraud` object with the `order` array set to `$values`. Existing `order` data will be replaced.
- withPayment() : MinFraud
- This returns a `MinFraud` object with the `payment` array set to `$values`. Existing `payment` data will be replaced.
- withShipping() : MinFraud
- This returns a `MinFraud` object with the `shipping` array set to `$values`. Existing `shipping` data will be replaced.
- withShoppingCartItem() : MinFraud
- This returns a `MinFraud` object with `$values` added to the shopping cart array.
Constants
VERSION
public
mixed
VERSION
= 'v1.21.0'
Methods
__construct()
public
__construct(int $accountId, string $licenseKey[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $accountId : int
-
Your MaxMind account ID
- $licenseKey : string
-
Your MaxMind license key
- $options : array<string|int, mixed> = []
-
An array of options. Possible keys:
-
host
- The host to use when connecting to the web service. -
userAgent
- The prefix for the User-Agent header to use in the request. -
caBundle
- The bundle of CA root certificates to use in the request. -
connectTimeout
- The connect timeout to use for the request. -
hashEmail
- By default, the email address is sent in plain text. If this is set totrue
, the email address will be normalized and converted to an MD5 hash before the request is sent. The email domain will continue to be sent in plain text. -
timeout
- The timeout to use for the request. -
proxy
- The HTTP proxy to use. May include a schema, port, username, and password, e.g.,http://username:password@127.0.0.1:10
. -
locales
- An array of locale codes to use for the location name properties. -
validateInput
- Default istrue
. Determines whether values passed to thewith*()
methods are validated. It is recommended that you leave validation on while developing and only (optionally) disable it before deployment.
-
Return values
mixed —factors()
This method performs a minFraud Factors lookup using the request data in the current object and returns a model object for minFraud Factors.
public
factors() : Factors
Tags
Return values
Factors —minFraud Factors model object
insights()
This method performs a minFraud Insights lookup using the request data in the current object and returns a model object for minFraud Insights.
public
insights() : Insights
Tags
Return values
Insights —minFraud Insights model object
score()
This method performs a minFraud Score lookup using the request data in the current object and returns a model object for minFraud Score.
public
score() : Score
Tags
Return values
Score —minFraud Score model object
with()
This returns a `MinFraud` object with the array to be sent to the web service set to `$values`. Existing values will be replaced.
public
with(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withAccount()
This returns a `MinFraud` object with the `account` array set to `$values`. Existing `account` data will be replaced.
public
withAccount(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withBilling()
This returns a `MinFraud` object with the `billing` array set to `$values`. Existing `billing` data will be replaced.
public
withBilling(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withCreditCard()
This returns a `MinFraud` object with the `credit_card` array set to `$values`. Existing `credit_card` data will be replaced.
public
withCreditCard(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withCustomInputs()
This returns a `MinFraud` object with the `custom_inputs` array set to `$values`. Existing `custom_inputs` data will be replaced.
public
withCustomInputs(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withDevice()
This returns a `MinFraud` object with the `device` array set to `$values`. Existing `device` data will be replaced.
public
withDevice(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withEmail()
This returns a `MinFraud` object with the `email` array set to `$values`. Existing `email` data will be replaced.
public
withEmail(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withEvent()
This returns a `MinFraud` object with the `events` array set to `$values`. Existing `event` data will be replaced.
public
withEvent(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withOrder()
This returns a `MinFraud` object with the `order` array set to `$values`. Existing `order` data will be replaced.
public
withOrder(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withPayment()
This returns a `MinFraud` object with the `payment` array set to `$values`. Existing `payment` data will be replaced.
public
withPayment(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withShipping()
This returns a `MinFraud` object with the `shipping` array set to `$values`. Existing `shipping` data will be replaced.
public
withShipping(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.
withShoppingCartItem()
This returns a `MinFraud` object with `$values` added to the shopping cart array.
public
withShoppingCartItem(array<string|int, mixed> $values) : MinFraud
Parameters
- $values : array<string|int, mixed>
Tags
Return values
MinFraud —A new immutable MinFraud object. This object is a clone of the original with additional data.