Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance MinFraud Documentation: Add Detailed Information on Available Options #152

Merged
merged 4 commits into from
Aug 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ and [Report Transaction](https://dev.maxmind.com/minfraud/report-transaction/) A
### minFraud API ###

To use the minFraud API, create a new `\MaxMind\MinFraud` object. The constructor
takes your MaxMind account ID, license key, and an optional options array as
takes your MaxMind account ID, license key, and an optional [options](#Options) array as
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could link to the API docs that have separate docs about these in the README - see here.

For GeoIP2 APIs, we reference the other hosts like so. Could we do the same here for the sandbox?

arguments. This object is immutable. You then build up the request using the
`->with*` methods as shown below. Each method call returns a new object. The
previous object is not modified.
Expand Down Expand Up @@ -314,6 +314,40 @@ $rt->report([
]);
```

## Options

When using the MinFraud client in PHP, you have the flexibility to customize its behavior by providing various options. The options parameter is used to pass these customizations to the client when instantiating it.

| Option | Description |
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **host** | The host to use when connecting to the web service. By default, the client connects to the production host. However, during testing and development, you can set this option to '[sandbox.maxmind.com](sandbox.maxmind.com)' to use the sandbox host. The sandbox host allows you to experiment with the API without affecting your production data. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this kind of stuff would belong in the API docs. See here for how we mention the alternate host for the GeoIP2-php API.

| **userAgent** | The prefix for the User-Agent header to use in the request. The User-Agent header provides information about the client making the API request. You can customize the User-Agent by providing a custom prefix. This can be useful for identifying your API requests separately from other clients. |
| **caBundle** | The bundle of CA root certificates to use in the request. When making secure connections (HTTPS), the client needs to validate the server's SSL certificate. You can provide the path to a certificate bundle file (e.g., `/path/to/cabundle.pem`) to establish secure connections with proper certificate validation. |
| **connectTimeout** | The connect timeout to use for the request in seconds. This option determines the maximum time allowed for the client to establish a connection with the server. If the connection cannot be established within this time, the request will be considered timed out. |
| **hashEmail** | By default, the email address is sent in plain text when using the withEmail() method. However, if this option 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. Hashing the email can be useful for privacy and security reasons. |
| **timeout** | The timeout to use for the request in seconds. This option determines the maximum time allowed for the entire request process, including establishing the connection, sending the data, and receiving the response. If the request exceeds this time, it will be considered timed out. |
| **proxy** | The HTTP proxy to use. If your server requires an HTTP proxy to connect to external services, you can set this option to specify the proxy details. Provide the proxy details, including the schema, port, username, and password if required. |
| **locales** | An array of locale codes to use for the location name properties. The MinFraud API provides location names in different languages. By specifying multiple locale codes (e.g., ['en', 'fr']), you can receive localized location names in the response. |
| **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. Validation helps ensure that the data passed to the client's methods meets the required criteria. |



```php
$options = [
'host' => 'sandbox.maxmind.com',
'userAgent' => 'MyCustomUserAgentPrefix',
'caBundle' => '/path/to/cabundle.pem',
'connectTimeout' => 5, // in seconds
'hashEmail' => true,
'timeout' => 10, // in seconds
'proxy' => 'http://username:password@127.0.0.1:8080',
'locales' => ['en', 'fr'],
'validateInput' => true,
];

$mf = new MinFraud(1, 'ABCD567890', $options);
```

## Support ##

Please report all issues with this code using the
Expand Down