deracs/silverstripe-geoip2

GeoIP2 Country for SilverStripe

Installs: 667

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:silverstripe-module

0.0.8 2019-01-15 20:45 UTC

This package is auto-updated.

Last update: 2020-06-16 00:58:58 UTC


README

This package will grab the country information about the current user

composer require deracs/silverstripe-geoip2

Example

$reader = new GeoIPReader(); // can pass IP thorugh here as well
$reader->getReader(); // Returns the country model
$reader->getIsoCode(); // US, NZ, etc
$reader->getCountry(); // United States

Usage

Download the MaxMind DB and then add the path to the admin settings http://{URL}/admin/settings/ under the settings tab.

You can also update it through the config (admin settings will take priority):

GeoIPReader:
  GeoPath: '/folder/location/file.mmdb'
  fake-ip: false

Requirements

  • SilverStripe 3+
  • GeoIP2
  • PHP 7+

TODO

  • Tests
  • SS4