Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mooore-digital/magento2-module-geoip
Magento 2 module providing basic Geo IP detection
https://github.com/mooore-digital/magento2-module-geoip
geo-ip-detection geoip ipinfo magento2 magento2-module
Last synced: about 1 month ago
JSON representation
Magento 2 module providing basic Geo IP detection
- Host: GitHub
- URL: https://github.com/mooore-digital/magento2-module-geoip
- Owner: mooore-digital
- Created: 2019-09-16T12:22:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-10T09:05:10.000Z (over 3 years ago)
- Last Synced: 2024-11-16T08:18:06.489Z (about 2 months ago)
- Topics: geo-ip-detection, geoip, ipinfo, magento2, magento2-module
- Language: PHP
- Homepage:
- Size: 23.4 KB
- Stars: 5
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Magento 2 GeoIp
Magento 2 module providing basic Geo IP detection.## API
### REST
```bash
$ curl https:///rest/V1/countryCode
"NL"
```### PHP
``` php
countryCode = $countryCode;
}public function execute(): void
{
//output: Country is NL
echo sprintf('Country is %s', $this->countryCode->get());
}
}
```## Installation
```bash
composer require mooore/magento2-module-geoip
bin/magento setup:upgrade
```## Configuration
This module has a fallback reliance on several inputs:
1. [GeoIP](http://nginx.org/en/docs/http/ngx_http_geoip_module.html) variable `GEOIP_COUNTRY_CODE`.
2. [GeoIP2](https://github.com/leev/ngx_http_geoip2_module) variable `COUNTRY_CODE`.
3. [Cloudflare](https://www.cloudflare.com/) header `CF-IPCountry`.
4. [IpInfo.io](https://ipinfo.io/) API.To be able to fall back on IpInfo.io, follow these steps:
1. Have an account at [ipinfo.io](https://ipinfo.io/) (usage is free for 50k requests per month).
2. Have the ipinfo.io API key.
3. Configure it in the Magento 2 backend (Advanced -> System -> GeoIP):
![Configuration](docs/configuration.png)