1- # MaxMind minFraud PHP API #
1+ # MaxMind minFraud PHP API
22
3- ## Description ##
3+ ## Description
44
5- This package provides an API for the [ MaxMind minFraud Score, Insights, and
6- Factors web services] ( https://dev.maxmind.com/minfraud/ ) .
5+ This package provides an API for the
6+ [ MaxMind minFraud web services] ( https://dev.maxmind.com/minfraud/ ) .
77
8- ## Install via Composer ##
8+ ## Install via Composer
99
10- We recommend installing this package with [ Composer] ( https://getcomposer.org/ ) .
10+ We recommend installing this package with
11+ [ Composer] ( https://getcomposer.org/ ) .
1112
12- ### Download Composer ###
13+ ### Download Composer
1314
1415To download Composer, run in the root directory of your project:
1516
@@ -19,7 +20,7 @@ curl -sS https://getcomposer.org/installer | php
1920
2021You should now have the file ` composer.phar ` in your project directory.
2122
22- ### Install Dependencies ###
23+ ### Install Dependencies
2324
2425Run in your project root:
2526
@@ -31,7 +32,7 @@ You should now have the files `composer.json` and `composer.lock` as well as
3132the directory ` vendor ` in your project directory. If you use a version control
3233system, ` composer.json ` should be added to it.
3334
34- ### Require Autoloader ###
35+ ### Require Autoloader
3536
3637After installing the dependencies, you need to require the Composer autoloader
3738from your code:
@@ -40,67 +41,72 @@ from your code:
4041require 'vendor/autoload.php';
4142```
4243
43- ## Install via Phar ##
44+ ## Install via Phar
4445
4546Although we strongly recommend using Composer, we also provide a
4647[ phar archive] ( https://php.net/manual/en/book.phar.php ) containing most of the
4748dependencies for this API. The latest phar archive is available on
4849[ our releases page] ( https://github.com/maxmind/minfraud-api-php/releases ) .
4950
50- ### Install Dependencies ###
51+ ### Install Dependencies
5152
52- Please note that you must have the PHP [ cURL
53- extension] ( https://php.net/manual/en/book.curl.php ) installed to use this
54- archive. For Debian based distributions, this can typically be found in the
53+ Please note that you must have the PHP
54+ [ cURL extension] ( https://php.net/manual/en/book.curl.php ) installed to use
55+ this archive. For Debian based distributions, this can typically be found in
5556the ` php-curl ` package. For other operating systems, please consult the
56- relevant documentation. After installing the extension you may need to
57- restart your web server.
57+ relevant documentation. After installing the extension you may need to restart
58+ your web server.
5859
5960If you are missing this extension, you will see errors like the following:
6061
6162```
6263PHP Fatal error: Uncaught Error: Call to undefined function MaxMind\WebService\curl_version()
6364```
6465
65- ### Require Package ###
66+ ### Require Package
6667
6768To use the archive, just require it from your script:
6869
6970``` php
7071require 'minfraud.phar';
7172```
7273
73- ## API Documentation ###
74+ ## API Documentation
7475
75- More detailed API documentation is available on [ our GitHub
76- Page] ( https://maxmind.github.io/minfraud-api-php/ ) under the "API" tab.
76+ More detailed API documentation is available on
77+ [ our GitHub Page] ( https://maxmind.github.io/minfraud-api-php/ ) under the "API"
78+ tab.
7779
78- ## Usage ##
80+ ## Usage
7981
80- This library provides access to both the [ minFraud (Score, Insights and
81- Factors)] ( https://dev.maxmind.com/minfraud/ )
82- and [ Report Transaction] ( https://dev.maxmind.com/minfraud/report-transaction/ ) APIs.
82+ This library provides access to both the
83+ [ minFraud (Score, Insights and Factors)] ( https://dev.maxmind.com/minfraud/ )
84+ and [ Report Transaction] ( https://dev.maxmind.com/minfraud/report-transaction/ )
85+ APIs.
8386
84- ### minFraud API ###
87+ ### minFraud API
8588
86- To use the minFraud API, create a new ` \MaxMind\MinFraud ` object. The constructor
87- takes your MaxMind account ID, license key, and an optional ` options ` array as
88- arguments. This object is immutable. See the API documentation for the possible options.
89+ To use the minFraud API, create a new ` \MaxMind\MinFraud ` object. The
90+ constructor takes your MaxMind account ID, license key, and an optional
91+ ` options ` array as arguments. This object is immutable. See the API
92+ documentation for the possible options.
8993
90- For instance, to use the Sandbox web service instead of the production web service, you can provide the host option:
94+ For instance, to use the Sandbox web service instead of the production web
95+ service, you can provide the host option:
9196
9297``` php
9398$mf = new MinFraud(1, 'ABCD567890', [ 'host' => 'sandbox.maxmind.com' ]);
9499```
95100
96- Build up the request using the ` ->with* ` methods as shown below. Each method call returns a new object. The previous object is not modified.
101+ Build up the request using the ` ->with* ` methods as shown below. Each method
102+ call returns a new object. The previous object is not modified.
97103
98- If there is a validation error in the data passed to a ` ->with* ` method, a
99- ` \MaxMind\Exception ` will be thrown. This validation can be disabled by
100- setting ` validateInput ` to ` false ` in the options array for
101- ` \MaxMind\MinFraud ` , but it is recommended that you keep it on at least
102- through development as it will help ensure that you are sending valid data to
103- the web service.
104+ If there is a validation error in the data passed to a ` ->with* ` method, an
105+ exception in the ` \MaxMind\Exception ` namespace will be thrown. This
106+ validation can be disabled by setting ` validateInput ` to ` false ` in the
107+ options array for ` \MaxMind\MinFraud ` , but it is recommended that you keep it
108+ on at least through development as it will help ensure that you are sending
109+ valid data to the web service.
104110
105111After creating the request object, send a Score request by calling
106112` ->score() ` , an Insights request by calling ` ->insights() ` , or a Factors
@@ -110,30 +116,29 @@ thrown.
110116
111117See the API documentation for more details.
112118
113- #### minFraud Exceptions ####
119+ #### minFraud Exceptions
114120
115121All externally visible exceptions are in the ` \MaxMind\Exception ` namespace.
116122The possible exceptions are:
117123
118- * ` InvalidInputException ` - This will be thrown when a ` ->with* ` method is
124+ - ` InvalidInputException ` - This will be thrown when a ` ->with* ` method is
119125 called with invalid input data.
120- * ` AuthenticationException ` - This will be thrown on calling ` ->score() ` ,
126+ - ` AuthenticationException ` - This will be thrown on calling ` ->score() ` ,
121127 ` ->insights() ` , or ` ->factors() ` when the server is unable to authenticate
122128 the request, e.g., if the license key or account ID is invalid.
123- * ` InsufficientFundsException ` - This will be thrown on calling ` ->score() ` ,
129+ - ` InsufficientFundsException ` - This will be thrown on calling ` ->score() ` ,
124130 ` ->insights() ` , or ` ->factors() ` when your account is out of funds.
125- * ` InvalidRequestException ` - This will be thrown on calling ` ->score() ` ,
131+ - ` InvalidRequestException ` - This will be thrown on calling ` ->score() ` ,
126132 ` ->insights() ` , or ` ->factors() ` when the server rejects the request for
127133 another reason such as invalid JSON in the POST.
128- * ` HttpException ` - This will be thrown on calling ` ->score() ` , ` ->insights ()` ,
129- or ` ->factors() ` when an unexpected HTTP error occurs such as a firewall
130- interfering with the request to the server.
131- * ` WebServiceException ` - This will be thrown on calling ` ->score() ` ,
134+ - ` HttpException ` - This will be thrown on calling ` ->score() ` ,
135+ ` ->insights() ` , or ` ->factors() ` when an unexpected HTTP error occurs such
136+ as a firewall interfering with the request to the server.
137+ - ` WebServiceException ` - This will be thrown on calling ` ->score() ` ,
132138 ` ->insights() ` , or ` ->factors() ` when some other error occurs. This also
133139 serves as the base class for the above exceptions.
134140
135-
136- #### minFraud Example ####
141+ #### minFraud Example
137142
138143``` php
139144<?php
@@ -255,52 +260,52 @@ foreach ($scoreResponse->warnings as $warning) {
255260}
256261```
257262
258- ### Report Transactions API ###
263+ ### Report Transactions API
259264
260- MaxMind encourages the use of this API as data received through this channel is
261- used to continually improve the accuracy of our fraud detection algorithms.
265+ MaxMind encourages the use of this API as data received through this channel
266+ is used to continually improve the accuracy of our fraud detection algorithms.
262267
263268To use the Report Transactions API, create a new
264- ` \MaxMind\MinFraud\ReportTransaction ` object. The constructor takes your MaxMind
265- account ID, license key, and an optional options array as arguments. This object
266- is immutable. You then send one or more reports using the ` ->report ` method as
267- shown below.
269+ ` \MaxMind\MinFraud\ReportTransaction ` object. The constructor takes your
270+ MaxMind account ID, license key, and an optional options array as arguments.
271+ This object is immutable. You then send one or more reports using the
272+ ` ->report ` method as shown below.
268273
269274If there is a validation error in the data passed to the ` ->report ` method, a
270275` \MaxMind\Exception ` will be thrown. This validation can be disabled by
271276setting ` validateInput ` to ` false ` in the options array for
272- ` \MaxMind\MinFraud\ReportTransaction ` , but it is recommended that you keep it on
273- at least through development as it will help ensure that you are sending valid
274- data to the web service.
277+ ` \MaxMind\MinFraud\ReportTransaction ` , but it is recommended that you keep it
278+ on at least through development as it will help ensure that you are sending
279+ valid data to the web service.
275280
276281If the report is successful, nothing is returned. If the report fails, an
277- exception with be thrown.
282+ exception will be thrown.
278283
279284See the API documentation for more details.
280285
281- #### Report Transaction Exceptions ####
286+ #### Report Transaction Exceptions
282287
283288All externally visible exceptions are in the ` \MaxMind\Exception ` namespace.
284289The possible exceptions are:
285290
286- * ` InvalidInputException ` - This will be thrown when the ` ->report() ` method is
287- called with invalid input data or when the required fields are missing. The
288- required fields are ` tag ` and one or more of the following: ` ipAddress ` ,
291+ - ` InvalidInputException ` - This will be thrown when the ` ->report() ` method
292+ is called with invalid input data or when the required fields are missing.
293+ The required fields are ` tag ` and one or more of the following: ` ipAddress ` ,
289294 ` maxmindId ` , ` minfraudId ` , or ` transactionId ` .
290- * ` AuthenticationException ` - This will be thrown on calling ` ->report() ` ,
295+ - ` AuthenticationException ` - This will be thrown on calling ` ->report() ` ,
291296 when the server is unable to authenticate the request, e.g., if the license
292297 key or account ID is invalid.
293- * ` InvalidRequestException ` - This will be thrown on calling ` ->report() ` when
294- the server rejects the request for another reason such as invalid JSON in the
295- POST.
296- * ` HttpException ` - This will be thrown on calling ` ->report() ` when an
298+ - ` InvalidRequestException ` - This will be thrown on calling ` ->report() ` when
299+ the server rejects the request for another reason such as invalid JSON in
300+ the POST.
301+ - ` HttpException ` - This will be thrown on calling ` ->report() ` when an
297302 unexpected HTTP error occurs such as a firewall interfering with the request
298303 to the server.
299- * ` WebServiceException ` - This will be thrown on calling ` ->report() ` when some
300- other error occurs. This also serves as the base class for the above
304+ - ` WebServiceException ` - This will be thrown on calling ` ->report() ` when
305+ some other error occurs. This also serves as the base class for the above
301306 exceptions.
302307
303- #### Report Transaction Example ####
308+ #### Report Transaction Example
304309
305310``` php
306311<?php
@@ -322,33 +327,33 @@ $rt->report(
322327);
323328```
324329
325- ## Support ##
330+ ## Support
326331
327332Please report all issues with this code using the
328333[ GitHub issue tracker] ( https://github.com/maxmind/minfraud-api-php/issues ) .
329334
330- If you are having an issue with the minFraud service that is not specific
331- to the client API, please see
335+ If you are having an issue with the minFraud service that is not specific to
336+ the client API, please see
332337[ our support page] ( https://www.maxmind.com/en/support ) .
333338
334- ## Requirements ##
339+ ## Requirements
335340
336341This code requires PHP 8.1 or greater. Older versions of PHP are not
337342supported.
338343
339344There are several other dependencies as defined in the ` composer.json ` file.
340345
341- ## Contributing ##
346+ ## Contributing
342347
343348Patches and pull requests are encouraged. All code should follow the PSR-2
344349style guidelines. Please include unit tests whenever possible.
345350
346- ## Versioning ##
351+ ## Versioning
347352
348353This API uses [ Semantic Versioning] ( https://semver.org/ ) .
349354
350- ## Copyright and License ##
355+ ## Copyright and License
351356
352- This software is Copyright (c) 2015-2025 by MaxMind, Inc.
357+ This software is Copyright (c) 2015-2026 by MaxMind, Inc.
353358
354359This is free software, licensed under the Apache License, Version 2.0.
0 commit comments