定制 magefan/module-geoip 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

magefan/module-geoip

最新稳定版本:2.3.5

Composer 安装命令:

composer require magefan/module-geoip

包简介

Allows to get country code by IP

README 文档

README

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

🇺🇦 Stand with Ukraine! How can you help?

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 and MaxMind EULA.

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

Originally use these databases:

https://www.maxmind.com

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

Magento 2 Extensions by Magefan

Magento 2 Google Extensions

Magento 2 SEO Extensions

Magento 2 Speed Optimization Extensions

Magento 2 Admin Panel Extensions

Magento 2 Blog Extensions

Magento 2 Marketing Automation Extensions

Magento 2 Cart Extensions

Magento 2 Multi-Language Extensions

Developers Tools

Shopify Apps by Magefan

统计信息

  • 总下载量: 210.81k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 54
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 54
  • Watchers: 2
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-01-24