Skip to content

Commit 0f5cf49

Browse files
authored
Adds host and locales config variables to enable support for the free… (#44)
1 parent bb05594 commit 0f5cf49

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

config/geoip.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
'maxmind_api' => [
6161
'user_id' => env('GEOIP_MAXMIND_USER_ID'),
6262
'license_key' => env('GEOIP_MAXMIND_LICENSE_KEY'),
63+
//maxmind api will default to paid service. Use 'geolite.info' for free GeoLite2 Web service. https://github.com/maxmind/GeoIP2-php#usage-1
64+
'host' => env('GEOIP_MAXMIND_HOST'),
65+
//local required on client call but defaults to 'en' for english.
66+
'locales' => ['en'],
6367
],
6468

6569
/*

src/Drivers/MaxmindApiDriver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ protected function create()
1919
{
2020
$userId = Arr::get($this->config, 'user_id', false);
2121
$licenseKey = Arr::get($this->config, 'license_key', false);
22+
$host = Arr::get($this->config, 'host');
23+
$locales = Arr::get($this->config, 'locales');
2224

2325
// check and make sure they are set
2426
if (! $userId || ! $licenseKey) {
2527
throw new InvalidCredentialsException();
2628
}
2729

28-
return new Client((int) $userId, $licenseKey);
30+
return new Client((int) $userId, $licenseKey, $locales, ['host'=>$host]);
2931
}
3032
}

0 commit comments

Comments
 (0)