2017 © Pedro Peláez
 

magento2-module module-geoip

Allows to get country code by IP

image

magefan/module-geoip

Allows to get country code by IP

  • Monday, July 23, 2018
  • by IhorVansach
  • Repository
  • 4 Watchers
  • 9 Stars
  • 233 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 86 % Grown

The README.md

Magento 2 GeoIP Database Extension by Magefan

Total Downloads Latest Stable Version, (*1)

, (*2)

, (*3)

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

It is used for Magento 2 Currency Auto Switcher and Magento 2 Auto Language Switcher by Magefan, (*5)

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., (*6)

Need More Features?

Please contact us to get a quote https://magefan.com/contact, (*7)

License

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

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

Originaly use this databases:

https://www.maxmind.com, (*10)

http://software77.net/geo-ip/, (*11)

Magento 2 Extensions by Magefan

Magento 2 Google Extensions

Magento 2 SEO Extensions

Magento 2 Speed Optimization Extensions

Magento 2 Blog Extensions

Magento 2 Marketing Automation Extensions

Magento 2 Cart Extensions

Magento 2 Multi-Language Extensions

Developers Tools

The Versions

23/07 2018

dev-master

9999999-dev

Allows to get country code by IP

  Sources   Download

The Requires

 

16/05 2018

2.0.5

2.0.5.0

Allows to get country code by IP

  Sources   Download

The Requires

 

11/05 2018

2.0.4

2.0.4.0

Allows to get country code by IP

  Sources   Download

The Requires

 

13/04 2018

2.0.3

2.0.3.0

Allows to get country code by IP

  Sources   Download

The Requires

  • php ~5.6.5 || >=7.0

 

20/02 2018

2.0.2

2.0.2.0

Allows to get country code by IP

  Sources   Download

The Requires

  • php ~5.6.5 || >=7.0

 

29/01 2018

2.0.1

2.0.1.0

Allows to get country code by IP

  Sources   Download

The Requires

  • php ~5.6.5 || >=7.0

 

24/01 2018

2.0.0

2.0.0.0

Allows to get country code by IP

  Sources   Download

The Requires

  • php ~5.6.5 || >=7.0