📊 State of Magento 2025

The Home for Magento 2 Excellence

Quality-tested Magento 2 modules. Explore. Evaluate. Elevate. #magento2

613 Modules
401 Ready
211 Need Help
🏆 Leaderboard
Potentially Abandoned v1.1.1

Magento2 Module Geoip

mooore/magento2-module-geoip

Detects a visitor's country using GeoIP data. Provides a REST API and PHP interface to retrieve the country code, with fallback options.

38,051
Downloads
Below average
5
GitHub Stars
Below average
5y ago
Last Release
0
Open Issues
Build Issues
0/3 checks passed

Build Tests

Composer Install
DI Compile
Templates

Code Quality

CS Coding Standard
PHPStan

Tested on Magento 2.4.8-p3

Recent Test History

Each release is tested against the latest Magento version at that time.

v1.1.1 on Magento 2.4.8-p3
Dec 28, 2025

Looking for Contributors

Composer installation fails. Your contribution could help the entire Magento community!

Contribute

Share This Module's Status

Magento2 Module Geoip Magento compatibility status badge

README

Loaded from GitHub

Magento 2 GeoIp

Magento 2 module providing basic Geo IP detection.

API

REST

$ curl https://<magento site>/rest/V1/countryCode
"NL"                                                                                                                                                                                                                        

PHP

<?php

namespace Acme\Component;

use Mooore\GeoIp\Api\CountryCodeInterface;

class SomeComponent
{
    /**
     * @var \Mooore\GeoIp\Api\CountryCodeInterface
     */
    private $countryCode;

    public function __construct(CountryCodeInterface $countryCode)
    {
        $this->countryCode = $countryCode;
    }

    public function execute(): void
    {
        //output: Country is NL
        echo sprintf('Country is %s', $this->countryCode->get());
    }
}

Installation

composer require mooore/magento2-module-geoip
bin/magento setup:upgrade

Configuration

This module has a fallback reliance on several inputs:

  1. GeoIP variable GEOIP_COUNTRY_CODE.
  2. GeoIP2 variable COUNTRY_CODE.
  3. Cloudflare header CF-IPCountry.
  4. IpInfo.io API.

To be able to fall back on IpInfo.io, follow these steps:

  1. Have an account at 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

This content is fetched directly from the module's GitHub repository. We are not the authors of this content and take no responsibility for its accuracy, completeness, or any consequences arising from its use.