From 7f03717dc6087f3e324649b87b635b6d79535d07 Mon Sep 17 00:00:00 2001 From: William Storey Date: Fri, 1 Sep 2023 15:17:54 -0700 Subject: [PATCH 1/2] Link to API docs --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4da76497..8b35f800 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,8 @@ If the record is not found, a `\GeoIp2\Exception\AddressNotFoundException` is thrown. If the database is invalid or corrupt, a `\MaxMind\Db\InvalidDatabaseException` will be thrown. -See the API documentation for more details. +See the [API documentation](https://maxmind.github.io/GeoIP2-php/) for more +details. ### City Example ### @@ -306,7 +307,8 @@ of which represents part of the data returned by the web service. If there is an error, a structured exception is thrown. -See the API documentation for more details. +See the [API documentation](https://maxmind.github.io/GeoIP2-php/) for more +details. ### Example ### From 897983d1d21ba8affa8e6641e1ae351aa290bf7e Mon Sep 17 00:00:00 2001 From: William Storey Date: Fri, 1 Sep 2023 15:20:38 -0700 Subject: [PATCH 2/2] Document using the sandbox --- README.md | 11 ++++++++++- src/WebService/Client.php | 7 ++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8b35f800..f92a4162 100644 --- a/README.md +++ b/README.md @@ -294,6 +294,13 @@ service: $client = new Client(42, 'abcdef123456', ['en'], ['host' => 'geolite.info']); ``` +To call the Sandbox GeoIP2 web service instead of the production GeoIP2 web +service: + +```php +$client = new Client(42, 'abcdef123456', ['en'], ['host' => 'sandbox.maxmind.com']); +``` + After creating the client, you may now call the method corresponding to a specific endpoint with the IP address to look up, e.g.: @@ -321,7 +328,9 @@ use GeoIp2\WebService\Client; // Replace "42" with your account ID and "license_key" with your license // key. Set the "host" to "geolite.info" in the fourth argument options // array to use the GeoLite2 web service instead of the GeoIP2 web -// service. +// service. Set the "host" to "sandbox.maxmind.com" in the fourth argument +// options array to use the Sandbox GeoIP2 web service instead of the +// production GeoIP2 web service. $client = new Client(42, 'abcdef123456'); // Replace "city" with the method corresponding to the web service that diff --git a/src/WebService/Client.php b/src/WebService/Client.php index dddaab0b..8a773584 100644 --- a/src/WebService/Client.php +++ b/src/WebService/Client.php @@ -68,7 +68,12 @@ class Client implements ProviderInterface * * `host` - The host to use when querying the web * service. To query the GeoLite2 web service * instead of the GeoIP2 web service, set the - * host to `geolite.info`. + * host to `geolite.info`. To query the Sandbox + * GeoIP2 web service instead of the production + * GeoIP2 web service, set the host to + * `sandbox.maxmind.com`. The sandbox allows you to + * experiment with the API without affecting your + * production data. * * `timeout` - Timeout in seconds. * * `connectTimeout` - Initial connection timeout in seconds. * * `proxy` - The HTTP proxy to use. May include a schema, port,