# mageplaza/module-geoip

`composer require mageplaza/module-geoip`

Canonical URL: https://packagento.com/mageplaza/module-geoip

## At a glance

- **Vendor**: mageplaza (https://packagento.com/mageplaza.md)
- **Latest version**: 4.0.3 — released 2025-07-28
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/mageplaza/module-geoip and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require mageplaza/module-geoip:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## README


GeoIP Library for Magento 2 provides stores with GeoIP Database, which supports to detect the current geolocation of customer using his IP address. 

- Discover customers' location quickly
- Fully compatible with [Mageplaza Store Switcher](https://www.mageplaza.com/magento-2-store-switcher/)

### 1. GeoIp Documentation 

- [Installation guide](https://www.mageplaza.com/install-magento-2-extension/)
- [User guide](https://docs.mageplaza.com/geoip-library/index.html)
- [Introduction page](http://www.mageplaza.com/magento-2-geoip/)
- [Contribute on Github](https://github.com/mageplaza/magento-2-geoip-library)
- [Get Support](https://github.com/mageplaza/magento-2-geoip-library/issues)


### 2. FAQs

**Q: I got error: Mageplaza_Core has been already defined**

A: Read solution [here](https://github.com/mageplaza/module-core/issues/3)

**Q: What is the library used for?**

A: GeoIP library contains the GeoLite 2 geolocation database. Based on this, you can take advantage to build up other advanced functions such as auto-detect customer’ address to [suggest stores](https://www.mageplaza.com/magento-2-store-locator-extension/), s[witch appropriate language storeview](https://www.mageplaza.com/magento-2-store-switcher/). 
   

### 3. How to install GeoIP extension for Magento 2

Install via composer (recommend)

Run the following command in Magento 2 root folder:

```
composer require mageplaza/module-geoip
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
```

### 4. Highlight features

The module is built based on the GeoLite 2 database, also the IP geolocation database. The GeoLite2 Country, City, and ASN databases are updated frequently. 

In this free module, the store admin can download the library to get the Geolocation database. The database is the basement to power other advanced location functions (store switching, store locating) 

With 2 simple steps, you can download the geodatabase library and enable the module to activate the library and come into usage. 

![Highlight features](https://i.imgur.com/K0xoXAV.png)

GeoIP library is used to develop [Magento 2 Store Switcher](https://www.mageplaza.com/magento-2-store-switcher/), [Magento 2 Store Locator](https://www.mageplaza.com/magento-2-store-locator-extension/) and [Magento 2 Store Pickup](https://www.mageplaza.com/magento-2-store-pickup-extension/) by Mageplaza 


### 5. How to configure the GeoIP module

From the `Admin Panel`, go to `Stores > Configuration > Mageplaza Extension > Geo IP`, choose `Geo IP Configuration` section.

![Imgur](https://i.imgur.com/z5uvaP0.png)

- **Enable Geo IP**, please select `Yes` to turn on GeoIP module function which helps you define customers' countries then direct them to the related store views. 

- **Download Library button**: Click `Download Library` button to download Geo IP library before enabling it.



**People also search:**
- geoip magento 2
- magento 2 geo ip
- magento 2 geoip extension
- magento 2 geoip redirect
- magento 2 geoip store switcher
- magento 2 geolocation
- magento 2 geoip currency switcher


**Other free Magento 2 extensions on Github**
- [Magento 2 SEO Suite](https://github.com/mageplaza/magento-2-seo)
- [Magento 2 google maps](https://github.com/mageplaza/magento-2-google-maps)
- [Magento 2 Delete Orders](https://github.com/mageplaza/magento-2-delete-orders)
- [Magento 2 GDPR](https://github.com/mageplaza/magento-2-gdpr)
- [Magento 2 Backend Reindex](https://github.com/mageplaza/magento-2-backend-reindex)
- [Magento 2 Social login free](https://github.com/mageplaza/magento-2-social-login)
- [Magento 2 security](https://github.com/mageplaza/magento-2-security)
- [Magento 2 Blog](https://github.com/mageplaza/magento-2-blog)

## Changelog

CHANGELOG: https://www.mageplaza.com/releases/geoip/

## Recent Versions

| Version | Released |
|---|---|
| 4.0.3 | 2025-07-28 |
| 4.0.2 | 2025-04-17 |
| 1.0.8 | 2021-08-19 |
| 1.0.7 | 2021-07-09 |
| 4.0.1 | 2021-07-09 |
| 4.0.0 | 2020-10-01 |
| 1.0.6 | 2020-06-02 |
| 1.0.5 | 2019-12-30 |
| 1.0.4 | 2019-05-28 |
| 1.0.3 | 2019-01-31 |

Showing 10 of 13 versions. Full release history on https://packagento.com/mageplaza/module-geoip.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| geoip2/geoip2 | ^2.0 \|\| ^3.0 |
| mageplaza/module-core | ^1.5.13 |

## Quality

Latest release (4.0.3) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 37 | 37 warnings (ruleset: Magento2) — 14 auto-fixable with phpcbf |
| PHPMD | Warning | 2 | 2 rule violations (UnusedFormalParameter:1, IfStatementAssignment:1) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 58 | 58 | – | – |
| 2.4.8 | – | 58 | 58 | – |
| 2.4.9 | – | – | 56 | 56 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["mageplaza/module-geoip"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

mageplaza is a Magento 2 vendor on Packagento. See https://packagento.com/mageplaza.md for their full catalogue.

