\MaxMindMinFraud

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.

Summary

Methods
Properties
Constants
__construct()
with()
withDevice()
withEvent()
withAccount()
withEmail()
withBilling()
withShipping()
withPayment()
withCreditCard()
withCustomInputs()
withOrder()
withShoppingCartItem()
score()
insights()
factors()
No public properties found
VERSION
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

VERSION

VERSION = 'v1.14.0' : 

Methods

__construct()

__construct(int  $accountId, string  $licenseKey, array  $options = []) : mixed

Parameters

int $accountId

Your MaxMind account ID

string $licenseKey

Your MaxMind license key

array $options

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.
  • 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.

Returns

mixed

with()

with(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the array to be sent to the web service set to `$values`. Existing values will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withDevice()

withDevice(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the `device` array set to `$values`. Existing `device` data will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withEvent()

withEvent(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the `events` array set to `$values`. Existing `event` data will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withAccount()

withAccount(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the `account` array set to `$values`. Existing `account` data will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withEmail()

withEmail(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the `email` array set to `$values`. Existing `email` data will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withBilling()

withBilling(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the `billing` array set to `$values`. Existing `billing` data will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withShipping()

withShipping(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the `shipping` array set to `$values`. Existing `shipping` data will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withPayment()

withPayment(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the `payment` array set to `$values`. Existing `payment` data will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withCreditCard()

withCreditCard(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the `credit_card` array set to `$values`. Existing `credit_card` data will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withCustomInputs()

withCustomInputs(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the `custom_inputs` array set to `$values`. Existing `custom_inputs` data will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withOrder()

withOrder(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with the `order` array set to `$values`. Existing `order` data will be replaced.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

withShoppingCartItem()

withShoppingCartItem(array  $values) : \MaxMind\MinFraud

This returns a `MinFraud` object with `$values` added to the shopping cart array.

Parameters

array $values

Returns

\MaxMind\MinFraud —

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

score()

score() : \MaxMind\MinFraud\Model\Score

This method performs a minFraud Score lookup using the request data in the current object and returns a model object for minFraud Score.

Throws

\MaxMind\Exception\InvalidInputException

when the request has missing or invalid data

\MaxMind\Exception\AuthenticationException

when there is an issue authenticating the request

\MaxMind\Exception\InsufficientFundsException

when your account is out of funds

\MaxMind\Exception\InvalidRequestException

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

\MaxMind\Exception\HttpException

when an unexpected HTTP error occurs

\MaxMind\Exception\WebServiceException

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

Returns

\MaxMind\MinFraud\Model\Score —

minFraud Score model object

insights()

insights() : \MaxMind\MinFraud\Model\Insights

This method performs a minFraud Insights lookup using the request data in the current object and returns a model object for minFraud Insights.

Throws

\MaxMind\Exception\InvalidInputException

when the request has missing or invalid data

\MaxMind\Exception\AuthenticationException

when there is an issue authenticating the request

\MaxMind\Exception\InsufficientFundsException

when your account is out of funds

\MaxMind\Exception\InvalidRequestException

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

\MaxMind\Exception\HttpException

when an unexpected HTTP error occurs

\MaxMind\Exception\WebServiceException

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

Returns

\MaxMind\MinFraud\Model\Insights —

minFraud Insights model object

factors()

factors() : \MaxMind\MinFraud\Model\Factors

This method performs a minFraud Factors lookup using the request data in the current object and returns a model object for minFraud Factors.

Throws

\MaxMind\Exception\InvalidInputException

when the request has missing or invalid data

\MaxMind\Exception\AuthenticationException

when there is an issue authenticating the request

\MaxMind\Exception\InsufficientFundsException

when your account is out of funds

\MaxMind\Exception\InvalidRequestException

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

\MaxMind\Exception\HttpException

when an unexpected HTTP error occurs

\MaxMind\Exception\WebServiceException

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

Returns

\MaxMind\MinFraud\Model\Factors —

minFraud Factors model object