xiaogouxo/yii2-ip2region
Composer 安装命令:
composer require xiaogouxo/yii2-ip2region
包简介
ip2region extension for yii2 to retrieve Chinese geolocation information
README 文档
README
ip2region extension for yii2
Help you to retrieve Chinese geolocation information in 0.0x ms
*This extenestion provides two search modes, SEARCH_BTREE(the default mode) and SEARCH_BINARY. *It contains a very small database file,only 3.5M
Installation
To install, either run
$ php composer.phar require xiaogouxo/yii2-ip2region "*"
or add
"xiaogouxo/yii2-ip2region": "*"
to the require section of your composer.json file.
============
-
Add following lines into
main.phpconfiguration file:'components' => array( ... 'ip2region' => [ 'class' => '\xiaogouxo\ip2region\Geolocation', 'mode' => 'SEARCH_BTREE', ] ... ),
Usage
$ip = Yii::$app->request->userIP; $region = Yii::$app->ip2region->getRegion($ip);
Returns the following information
|中国|华南|广东省|深圳市|鹏博士
More
Inspired by yii2-IP2Location and ip2region.
中文说明
准确率99.9%的ip到地名的映射库,0.0x毫秒级查询,数据库文件大小只有3.5M http://git.oschina.net/lionsoul/ip2region 提供SEARCH_BTREE(默认)和SEARCH_BINARY两种查询模式
安装
-
在
main.php添加如下信息:'components' => array( ... 'ip2region' => [ 'class' => '\xiaogouxo\ip2region\Geolocation', 'database' => dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'xiaogouxo'.DIRECTORY_SEPARATOR.'yii2-ip2region'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'ip2region.db', 'mode' => 'SEARCH_BTREE', ] ... ),
感谢
狮子的魂提供的ipregion 和yii2-IP2Location插件
xiaogouxo/yii2-ip2region 适用场景与选型建议
xiaogouxo/yii2-ip2region 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.79k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 12 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yii」 「IP」 「region」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 xiaogouxo/yii2-ip2region 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 xiaogouxo/yii2-ip2region 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 xiaogouxo/yii2-ip2region 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Miaoxing Region Plugin
Philippines region, province, cities/municipalities and barangays Laravel migration and table seeder.
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
List of Italian Regioni (Regions), Province (Provinces), and Comuni (Municipalities) with data from Istat
Priveate for SkeekS CMS
C3JS Chart for Yii Framework 2.0
统计信息
- 总下载量: 4.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3
- 更新时间: 2015-12-13