GeoIP
Admiral plugin to get GeoIP data through the MaxMind GeoIP2 database
Getting Started
First, install the plugin using Composer
composer require admiral/geoip
Next, load the plugin into your Application.php:
class Application extends BaseApplication {
public function bootstrap() {
parent::bootstrap();
$this->addPlugin('Admiral/GeoIP');
}
}
Add some configs to your config/app.php:
'GeoIP' => [
'license' => 'YOUR_LICENSE_KEY',
'dir' => TMP,
],
Download the databases of choice:
bin/cake geoip download --asn --city --country
Loading a database:
use Admiral\GeoIP\Database;
$asnDb = new Database('GeoLite2-ASN.mmdb')->getReader();
After which it serves identically to the library from MaxMind.
Version Compatibility
Below a table of version compatibility.
Please note that when a new version is released, support for older versions by the maintainer drop immediately.