admiral/geoip

This package is abandoned and no longer maintained. No replacement package was suggested.

CakePHP GeoIP plugin

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:cakephp-plugin

1.0.0 2021-02-23 13:29 UTC

This package is auto-updated.

Last update: 2024-09-05 19:14:49 UTC


README

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();

    // Load the GeoIP plugin
    $this->addPlugin('Admiral/GeoIP');
  }
}

Add some configs to your config/app.php:

'GeoIP' => [
  'license' => 'YOUR_LICENSE_KEY',
  'dir' => TMP, // Or the directory you desire
],

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. | Plugin Version | CakePHP Version | |----------------|-----------------| | 1.x | >=3.6 |