Menu

Tree [26f555] master /
 History

HTTPS access


File Date Author Commit
 Block 2020-07-11 Ihor Vansach Ihor Vansach [b8abea] Changed naming in stores configuration
 Controller 2019-09-09 Ihor Vansach Ihor Vansach [441948] Removed already defined messageManager from con...
 Cron 2019-05-13 dev4 dev4 [340d2d] 2089-update Model, Cron [Implemented]
 Model 2020-07-11 Ihor Vansach Ihor Vansach [b8abea] Changed naming in stores configuration
 Setup 2019-05-14 dev4 dev4 [e10fe3] 2089-update Config Info [Implemented]
 data 2019-01-07 Ihor Vansach Ihor Vansach [3e76d1] Updated Maxmind GeoLite2 Country database
 etc 2020-07-11 Ihor Vansach Ihor Vansach [b8abea] Changed naming in stores configuration
 view 2020-05-31 Magefan Magefan [b09b5d] Fixed Fatal Error: Uncaught Error: Call to und...
 LICENSE.txt 2018-01-24 Ihor Vansach Ihor Vansach [7777dd] Code style changes
 README.md 2020-12-22 Magefan Magefan [26f555] Update README.md
 composer.json 2020-07-11 Ihor Vansach Ihor Vansach [b8abea] Changed naming in stores configuration
 registration.php 2018-01-24 Ihor Vansach Ihor Vansach [7777dd] Code style changes

Read Me

Magento 2 GeoIP Database Extension by Magefan

Total Downloads
Latest Stable Version

This Magento 2 GeoIP module provides you PHP methods for getting customer country by IP, without any additional plugin for PHP.

It is used for Magento 2 Currency Auto Switcher and Magento 2 Auto Language Switcher by Magefan

Requirements

  • Magento Community Edition 2.0.x-2.4.x or Magento Enterprise Edition 2.0.x-2.4.x

Installation Method 1 - Installing via composer

  • Open command line
  • Using command "cd" navigate to your magento2 root directory
  • Run command: composer require magefan/module-geoip
composer require magefan/module-geoip
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

Installation Method 2 - Installing using archive

  • Install GeoIP2 PHP API (https://github.com/maxmind/GeoIP2-php).
  • Download ZIP Archive
  • Extract files
  • In your Magento 2 root directory create folder app/code/Magefan/GeoIp
  • Copy files and folders from archive to that folder
  • In command line, using "cd", navigate to your Magento 2 root directory
  • Run commands:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

How To Use

protected $ipToCountryRepository;

public function __construct(
    \Magefan\GeoIp\Model\IpToCountryRepository $ipToCountryRepository,
    ....//other code
) {
    $this->ipToCountryRepository = $ipToCountryRepository;
    ...//other code
}

public function example() {
    $visitorCountyCode = $this->ipToCountryRepository->getVisitorCountryCode();
    $someCountryCodeByIp = $this->ipToCountryRepository->getCountryCode('104.27.164.57');
    ...//other code
}

Support

If you have any issues, please contact us
then if you still need help, open a bug report in GitHub's
issue tracker.

Need More Features?

Please contact us to get a quote
https://magefan.com/contact

License

The code is licensed under Open Software License ("OSL") v. 3.0.

This product includes GeoLite2 data created by MaxMind, available from
https://www.maxmind.com.

Originaly use this databases:

https://www.maxmind.com

http://software77.net/geo-ip/

Other Magento 2 Extensions by Magefan