tuandm/geoip2
Composer 安装命令:
composer require tuandm/geoip2
包简介
Extended MaxMind GeoIP2 PHP API
README 文档
README
Full package for GeoIP2-PHP
This library is a wrapper of https://github.com/maxmind/GeoIP2-php which uses to get geo information from IP. The database file is included. No need to download the database file (http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz) and construct the Reader instance with the file path.
use Tuandm\Database\Reader;
include_once "vendor/autoload.php";
$reader = new Reader();
// Or construct with mmdb file
// $reader = new Reader('/path/to/mmdb_file');
$record = $reader->city('52.192.103.163');
echo $record->city->name; // Tokyo
// We can also create Reader instance for reading country database
$reader = Reader::forCountry();
$record = $reader->country('52.192.103.163');
统计信息
- 总下载量: 8.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-17