magefan / module-geoip
该软件包最新版本(2.3.1)的许可信息不可用。
允许通过IP获取国家代码
2.3.1
2024-05-24 11:07 UTC
Requires
- geoip2/geoip2: ^2.9.0
- magefan/module-community: >=2.1.23
Suggests
- magefan/module-auto-currency-switcher: Install GeoIP Auto Currency Switcher Extension for Magento 2 (https://magefan.com/magento-2-currency-switcher-auto-currency-by-country). Use coupon code COMPOSER-FAN to get a 10% discount on magefan.com.
- magefan/module-auto-language-switcher: Install GeoIP Auto Language/Store Switcher Extension for Magento 2 (https://magefan.com/magento-2-auto-language-switcher). Use coupon code COMPOSER-FAN to get a 10% discount on magefan.com.
- dev-master
- 2.3.1
- 2.3.0
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- dev-10959-make-request-to-server-tag-same-as-web-tag-makes-to-server-tag
- dev-7972-update-config
- dev-6959-maxmindapi
- dev-6950-wrong-path-to-file
- dev-2276-cloud-flare-cf-ip
- dev-1464-country-info-block-in-stores-configuration
This package is auto-updated.
Last update: 2024-09-03 16:37:41 UTC
README
此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获取。
原使用此数据库
Magefan的Magento 2扩展
Magento 2管理面板扩展
- Magento 2管理动作日志
- Magento 2编辑订单扩展
- Magento 2更好的订单网格扩展
- Magento 2扩展产品网格
- Magento 2产品标签扩展
- Magento 2 Facebook像素扩展
- Magento 2电子邮件附件
- Magento 2管理视图扩展
- Magento 2管理电子邮件通知
- Magento 2登录为顾客扩展
Magento 2 Google扩展
- Magento 2 Google索引API
- Magento 2 Google Analytics 4扩展
- Magento 2 Google Tag Manager
- Magento 2 Google购物产品数据
- Magento 2 Google客户评论
Magento 2 SEO扩展
- Magento 2 SEO扩展
- Magento 2丰富片段扩展
- Magento 2 HTML网站地图扩展
- Magento 2 XML网站地图扩展
- Magento 2 Twitter卡扩展
- Magento 2 Facebook开放图扩展
Magento 2博客扩展
Magento 2 营销自动化扩展
- Magento 2 产品标签
- Magento 2 基础价格
- Magento 2 动态分类
- Magento 2 CMS 显示规则扩展
- Magento 2 自动相关产品
- Magento 2 价格历史
- Magento 2 Mautic 集成扩展
- Magento 2 YouTube 小部件扩展
Magento 2 购物车扩展
Magento 2 速度优化扩展
Magento 2 多语言扩展
- Magento 2 Hreflang 标签扩展
- Magento 2 自动货币切换器扩展
- Magento 2 自动语言切换器扩展
- Magento 2 GeoIP 切换器扩展
- Magento 2 翻译扩展