定制 geocoder-php/geoip2-provider 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

geocoder-php/geoip2-provider

最新稳定版本:4.4.0

Composer 安装命令:

composer require geocoder-php/geoip2-provider

包简介

Geocoder GeoIP2 adapter

README 文档

README

Build Status Latest Stable Version Total Downloads Monthly Downloads Quality Score Software License

This is the GeoIP2 provider from the PHP Geocoder. This is a READ ONLY repository. See the main repo for information and documentation.

Install

composer require geocoder-php/geoip2-provider

Usage

The provider requires either a database file, or paid access to the web service.

Using a database file

Both free geolite2 and the paid precision city and country databases are supported.

//Use a Maxmind GeoIP2 Database:
$reader = new \GeoIp2\Database\Reader('/path/to/geolite2.mmdb');

$adapter = new \Geocoder\Provider\GeoIP2\GeoIP2Adapter($reader);
$geocoder = new \Geocoder\Provider\GeoIP2\GeoIP2($adapter);

$address = $geocoder->geocodeQuery(\Geocoder\Query\GeocodeQuery::create('74.200.247.59'))->first();

Using the Precision Web Service (API)

The provider also support the Precision Web Services. Please note that these API are paid, and billed per request.

// Use the Maxmind GeoIP2 API:
$reader = new \GeoIp2\WebService\Client(<account_id>, '<licence_key>');

$adapter = new \Geocoder\Provider\GeoIP2\GeoIP2Adapter($reader);
$geocoder = new \Geocoder\Provider\GeoIP2\GeoIP2($adapter);

$address = $geocoder->geocodeQuery(\Geocoder\Query\GeocodeQuery::create('74.200.247.59'))->first();

Contribute

Contributions are very welcome! Send a pull request to the main repository or report any issues you find on the issue tracker.

统计信息

  • 总下载量: 804.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 3
  • 依赖项目数: 6
  • 推荐数: 1

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固