This project is not covered by Drupal’s security advisory policy.
Extends the GeoIP API to use local lookup with public data from IPLocate.io.
IPLocate.io offers the public GeoIP data under a Creative Commons license.
- This module loads the binary database and makes it available for use via a plugin for the GeoIP API.
- The data is stored in the private file system.
- The module allows you to download the database via the web interface or via Drush.
- Additionally, the database can be updated weekly via Cron.
- The module also provides its own service for querying additional data (e.g., continent).
Installation
- Install via composer with dependencies:
composer require drupal/geoip_iplocate
- Enable module, e.g. via drush:
drush en geoip_iplocate
- Open settings menu /admin/config/system/geoip/iplocate
- Download IPLocate database
- Enable cron and save the form
- Open test menu /admin/config/system/geoip/iplocate-test
- Test your IP address
- Open GEOIP settings menu /admin/config/system/geoip
- Choose "GeoIP via IPLocate.io" and save the form
Usage
Use own service
$service = \Drupal::service('geoip_iplocate.service');
$result = $service->lookup($ip_address);
Example output:
Array
(
[valid] => 1
[found] => 1
[ip] => 151.101.130.217
[country] => US
[country_name] => United States
[continent] => NA
[continent_name] => North America
[is_eu_country] =>
[raw] => Array
(
[continent_code] => NA
[country_code] => US
[country_name] => United States
)
)
Usage via GeoIP service
$service = \Drupal::service('geoip.geolocation');
$result = $service->geolocate($ip_address);
Example output:
US
Supporting organizations:
Development and Maintenance
Project information
- Project categories: Developer tools, Integrations, Site structure
- Ecosystem: GeoIP API
1 site reports using this module
- Created by jan kellermann on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.


