deracs / silverstripe-geoip2
GeoIP2 Country for SilverStripe
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 667
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:silverstripe-module
Requires
- php: >=7
- geoip2/geoip2: ^2.9
- silverstripe/framework: ^3.4
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