@@ -26,7 +26,7 @@ You should now have the file `composer.phar` in your project directory.
2626
2727Run in your project root:
2828
29- ```
29+ ``` sh
3030php composer.phar require geoip2/geoip2:~ 2.0
3131```
3232
@@ -265,13 +265,33 @@ print($record->network . "\n"); // '128.101.101.101/32'
265265### Usage ###
266266
267267To use this API, you must create a new ` \GeoIp2\WebService\Client `
268- object with your ` $accountId ` and ` $licenseKey ` , then you call the method
269- corresponding to a specific end point, passing it the IP address you want to
270- look up.
268+ object with your ` $accountId ` and ` $licenseKey ` :
269+
270+ ``` php
271+ $client = new Client(42, 'abcdef123456');
272+ ```
273+
274+ You may also call the constructor with additional arguments. The third argument
275+ specifies the language preferences when using the ` ->name ` method on the model
276+ classes that this client creates. The fourth argument is additional options
277+ such as ` host ` and ` timeout ` .
278+
279+ For instance, to call the GeoLite2 web service instead of GeoIP2 Precision:
280+
281+ ``` php
282+ $client = new Client(42, 'abcdef123456', ['en'], ['host' => 'geolite.info']);
283+ ```
284+
285+ After creating the client, you may now call the method corresponding to a
286+ specific endpoint with the IP address to look up, e.g.:
287+
288+ ``` php
289+ $record = $client->city('128.101.101.101');
290+ ```
271291
272- If the request succeeds, the method call will return a model class for the end
273- point you called. This model in turn contains multiple record classes, each of
274- which represents part of the data returned by the web service.
292+ If the request succeeds, the method call will return a model class for the
293+ endpoint you called. This model in turn contains multiple record classes, each
294+ of which represents part of the data returned by the web service.
275295
276296If there is an error, a structured exception is thrown.
277297
@@ -286,7 +306,8 @@ use GeoIp2\WebService\Client;
286306
287307// This creates a Client object that can be reused across requests.
288308// Replace "42" with your account ID and "license_key" with your license
289- // key.
309+ // key. Set the "host" to "geolite.info" in the fourth argument options
310+ // array to use the GeoLite2 web service instead of GeoIP2 Precision.
290311$client = new Client(42, 'abcdef123456');
291312
292313// Replace "city" with the method corresponding to the web service that
0 commit comments