This class provides a client API for accessing MaxMind minFraud Score
and Insights.
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.
Methods summary
public
|
#
__construct( integer $accountId, string $licenseKey, array $options = [] )
Parameters
- $accountId
- Your MaxMind account ID
- $licenseKey
- Your MaxMind license key
- $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.
|
public
MaxMind\MinFraud
|
#
with( $values )
This returns a MinFraud object with the array to be sent to the web
service set to $values . Existing values will be replaced.
This returns a MinFraud object with the array to be sent to the web
service set to $values . Existing values will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud
|
#
withDevice( $values )
This returns a MinFraud object with the device array set to
$values . Existing device data will be replaced.
This returns a MinFraud object with the device array set to
$values . Existing device data will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud
|
#
withEvent( $values )
This returns a MinFraud object with the events array set to
$values . Existing event data will be replaced.
This returns a MinFraud object with the events array set to
$values . Existing event data will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud
|
#
withAccount( $values )
This returns a MinFraud object with the account array set to
$values . Existing account data will be replaced.
This returns a MinFraud object with the account array set to
$values . Existing account data will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud
|
#
withEmail( $values )
This returns a MinFraud object with the email array set to
$values . Existing email data will be replaced.
This returns a MinFraud object with the email array set to
$values . Existing email data will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud
|
#
withBilling( $values )
This returns a MinFraud object with the billing array set to
$values . Existing billing data will be replaced.
This returns a MinFraud object with the billing array set to
$values . Existing billing data will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud
|
#
withShipping( $values )
This returns a MinFraud object with the shipping array set to
$values . Existing shipping data will be replaced.
This returns a MinFraud object with the shipping array set to
$values . Existing shipping data will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud
|
#
withPayment( $values )
This returns a MinFraud object with the payment array set to
$values . Existing payment data will be replaced.
This returns a MinFraud object with the payment array set to
$values . Existing payment data will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud
|
#
withCreditCard( $values )
This returns a MinFraud object with the credit_card array set to
$values . Existing credit_card data will be replaced.
This returns a MinFraud object with the credit_card array set to
$values . Existing credit_card data will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud
|
#
withCustomInputs( $values )
This returns a MinFraud object with the custom_inputs array set to
$values . Existing custom_inputs data will be replaced.
This returns a MinFraud object with the custom_inputs array set to
$values . Existing custom_inputs data will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
|
public
MaxMind\MinFraud
|
#
withOrder( $values )
This returns a MinFraud object with the order array set to
$values . Existing order data will be replaced.
This returns a MinFraud object with the order array set to
$values . Existing order data will be replaced.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud
|
#
withShoppingCartItem( $values )
This returns a MinFraud object with $values added to the shopping
cart array.
This returns a MinFraud object with $values added to the shopping
cart array.
Parameters
Returns
MaxMind\MinFraud A new immutable MinFraud object. This object is
a clone of the original with additional data.
Link
|
public
MaxMind\MinFraud\Model\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.
This method performs a minFraud Score lookup using the request data in
the current object and returns a model object for minFraud Score.
Returns
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.
|
public
MaxMind\MinFraud\Model\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.
This method performs a minFraud Insights lookup using the request data
in the current object and returns a model object for minFraud Insights.
Returns
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.
|
public
MaxMind\MinFraud\Model\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.
This method performs a minFraud Factors lookup using the request data
in the current object and returns a model object for minFraud Factors.
Returns
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.
|