magefan / module-geoip

该软件包最新版本(2.3.1)的许可信息不可用。

允许通过IP获取国家代码

安装数: 140,437

依赖项: 1

建议者: 0

安全: 0

星标: 52

关注者: 4

分支: 10

公开问题: 0

类型:magento2-module

2.3.1 2024-05-24 11:07 UTC

README

Total Downloads Latest Stable Version

此Magento 2 GeoIP模块为您提供了通过PHP获取客户国家代码的方法,无需任何额外的PHP插件。

它用于 Magefan 的 Magento 2 自动货币切换器Magento 2 自动语言切换器

要求

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

安装方法 1 - 使用composer安装

  • 打开命令行
  • 使用命令 "cd" 导航到您的magento2根目录
  • 运行命令: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

安装方法 2 - 使用存档安装

  • 安装GeoIP2 PHP API(https://github.com/maxmind/GeoIP2-php)。
  • 下载ZIP存档
  • 提取文件
  • 在您的magento2根目录中创建文件夹app/code/Magefan/GeoIp
  • 从存档中复制文件和文件夹到该文件夹
  • 在命令行中,使用 "cd",导航到您的magento2根目录
  • 运行命令
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

如何使用

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
}

支持

如果您有任何问题,请联系我们。如果仍然需要帮助,请在GitHub的问题跟踪器中打开错误报告。

需要更多功能?

请联系我们获取报价https://magefan.com/contact

许可

代码根据开放软件许可 ("OSL") v. 3.0进行许可。

该产品包括由MaxMind创建的GeoLite2数据,可在https://www.maxmind.com获取。

原使用此数据库

https://www.maxmind.com

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

Magefan的Magento 2扩展

Magento 2管理面板扩展

Magento 2 Google扩展

Magento 2 SEO扩展

Magento 2博客扩展

Magento 2 营销自动化扩展

Magento 2 购物车扩展

Magento 2 速度优化扩展

Magento 2 多语言扩展

开发者工具

Magento 2 销售点

Magento 2 主题

Shopify 应用