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
Ask your assistant about GeoIP via IPLocate.io
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.0-rc1 | Pre-release | 10–11 | Nov 28, 2026 | ||
| 1.0.x-dev | Dev | 10–11 | Nov 28, 2026 | ||
| 1.0.0-beta1 | Pre-release | 10–11 | Nov 28, 2026 |