seeley/ip2location
Composer 安装命令:
composer require seeley/ip2location
包简介
[Official Release] IP2Location PHP API to get location info from IPv4 and IPv6 address.
README 文档
README
This is the official release maintained by IP2Location.com
This PHP module provides fast lookup of country, region, city, latitude, longitude, ZIP code, time zone, ISP, domain name, connection speed, IDD code, area code, weather station code, weather station name, MNC, MCC, mobile brand, elevation, and usage type from IP address by using IP2Location database. This module uses a file based database available at IP2Location.com.
This module can be used in many types of projects such as:
- select the geographically closest mirror
- analyze your web server logs to determine the countries of your visitors
- credit card fraud detection
- software export controls
- display native language and currency
- prevent password sharing and abuse of service
- geotargeting in advertisement
Free IP2Location LITE and commerical databases are available for download.
- LITE database is available at https://lite.ip2location.com (Free with limited accuracy)
- Commercial database is availabe at https://www.ip2location.com (Comprehensive with high accuracy)
Monthly update is available for both IP2Location LITE and commercial database.
KEY FEATURES
- Support both IPv4 and IPv6 with ease. If you would like to enable IPv6 support, you just need to replace your BIN file with IPv6 version. That's it, and no code modification needed.
- Extensible. If you require different granularity of IP information, you can visit IP2Location.com to download the relevant BIN file, and the information will made ready for you.
- Comprehensive Information. There are more than 13 types of information that you can retrieve from an IP address. Please visit IP2Location.com for details.
INSTALLATION
To install this module, unzip the package and copy the following files to your web folder.
- IP2Location.php
- example.php
- databases/IP2LOCATION-LITE-DB1.BIN
To test this installation, please browse example.php using web browser.
USAGE
You can check the example.php file to learn more about usage.
Database Class
Below is the description of the functions available in the Database class.
| Function Name | Description |
|---|---|
| Constructor | Expect 2 input parameters:
|
| getDate | Return the database's compilation date as a string of the form 'YYYY-MM-DD' |
| getType | Return the database's type, 1 to 24 respectively for DB1 to DB24. Please visit https://www.ip2location.com/databases for details. |
| getModuleVersion | Return the version of module |
| getDatabaseVersion | Return the version of database |
| lookup | Return the IP information in array. Below is the information returned:
|
| getCidr | Return an array of the sub-network of an IP address. |
WebService Class
Below is the description of the functions available in the WebService class.
| Function Name | Description |
|---|---|
| Constructor | Expect 3 input parameters:
|
| lookup | Return the IP information in array.
|
| getCredit | Return remaining credit of the web service account. |
DEPENDENCIES
This library requires IP2Location BIN data file to function. You may download the BIN data file at
- IP2Location LITE BIN Data (Free): https://lite.ip2location.com
- IP2Location Commercial BIN Data (Comprehensive): https://www.ip2location.com
An outdated BIN database was provided in the databases folder for your testing. You are recommended to visit the above links to download the latest BIN database.
You can also sign up for IP2Location Web Service to lookup by IP2Location API.
IPv4 BIN vs IPv6 BIN
- Use the IPv4 BIN file if you just need to query IPv4 addresses.
- Use the IPv6 BIN file if you need to query BOTH IPv4 and IPv6 addresses.
OTHER FRAMEWORK LIBRARY
Below are the list of other framework library that you can install and use right away.
COPYRIGHT AND LICENCE
Copyright (C) 2005-2020 by IP2Location.com
License under MIT
seeley/ip2location 适用场景与选型建议
seeley/ip2location 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 522 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 07 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「geolocation」 「ip2location」 「ip2locationlite」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 seeley/ip2location 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 seeley/ip2location 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 seeley/ip2location 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
[Official Release] IP2Location PHP API to get location info from IPv4 and IPv6 address.
Maps in minutes. Powered by the Google Maps API.
The official PHP library for apiip.net that allowing customers to automate IP address validation and geolocation lookup in websites, applications and back-office system. Visit our API docs at https://apiip.net/documentation
A lightweight but powerful IP address lookup database solution to determine visitors country
Supports GeoIP services (sypexgeo.net).
Lookup for visitor's IP information, such as country, region, city, coordinates, zip code, time zone, ISP, domain name, connection type, area code, weather, MCC, MNC, mobile brand name, elevation and usage type.
统计信息
- 总下载量: 522
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-27