minFraud PHP API v1.21.0

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

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 to true, 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 is true. Determines whether values passed to the with*() 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
throws
InvalidInputException

when the request has missing or invalid data

throws
AuthenticationException

when there is an issue authenticating the request

throws
InsufficientFundsException

when your account is out of funds

throws
InvalidRequestException

when the request is invalid for some other reason, e.g., invalid JSON in the POST.

throws
HttpException

when an unexpected HTTP error occurs

throws
WebServiceException

when some other error occurs. This also serves as the base class for the above exceptions.

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
throws
InvalidInputException

when the request has missing or invalid data

throws
AuthenticationException

when there is an issue authenticating the request

throws
InsufficientFundsException

when your account is out of funds

throws
InvalidRequestException

when the request is invalid for some other reason, e.g., invalid JSON in the POST.

throws
HttpException

when an unexpected HTTP error occurs

throws
WebServiceException

when some other error occurs. This also serves as the base class for the above exceptions.

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
throws
InvalidInputException

when the request has missing or invalid data

throws
AuthenticationException

when there is an issue authenticating the request

throws
InsufficientFundsException

when your account is out of funds

throws
InvalidRequestException

when the request is invalid for some other reason, e.g., invalid JSON in the POST.

throws
HttpException

when an unexpected HTTP error occurs

throws
WebServiceException

when some other error occurs. This also serves as the base class for the above exceptions.

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
link

minFraud API docs

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
link

minFraud account API docs

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
link

minFraud billing API docs

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
link

minFraud credit_card API docs

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
link

minFraud device API docs

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
link

minFraud email API docs

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
link

minFraud event API docs

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
link

minFraud order API docs

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
link

minFraud payment API docs

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
link

minFraud shipping API docs

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
link

minFraud shopping cart item API docs

Return values
MinFraud

A new immutable MinFraud object. This object is a clone of the original with additional data.

Search results