Skip to content

Commit

Permalink
Merge pull request #213 from maxmind/horgh/sandbox
Browse files Browse the repository at this point in the history
Document using the sandbox
  • Loading branch information
faktas2 authored Sep 5, 2023
2 parents 543732f + 897983d commit 9de2f55
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###

Expand Down Expand Up @@ -293,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.:

Expand All @@ -306,7 +314,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 ###

Expand All @@ -319,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
Expand Down
7 changes: 6 additions & 1 deletion src/WebService/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9de2f55

Please sign in to comment.