PHPackages                             chinafuturelink/geo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. chinafuturelink/geo

ActiveLibrary

chinafuturelink/geo
===================

Location Services of FutureLink

2.2.4(1y ago)1411↓100%MITPHPPHP ^7.4

Since Feb 22Pushed 1y ago2 watchersCompare

[ Source](https://github.com/ChinaFutureLink/geo)[ Packagist](https://packagist.org/packages/chinafuturelink/geo)[ RSS](/packages/chinafuturelink-geo/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (26)Used By (0)

[![CircleCI](https://camo.githubusercontent.com/19e36c91691e6e8bcb8911cdb9e30987200b91d120efc2079be5908be567b0ef/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f6275696c642f6769746875622f4368696e614675747572654c696e6b2f67656f3f746f6b656e3d65653137313138303837303439356366656530363362383265353838343034313434316538653561)](https://camo.githubusercontent.com/19e36c91691e6e8bcb8911cdb9e30987200b91d120efc2079be5908be567b0ef/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f6275696c642f6769746875622f4368696e614675747572654c696e6b2f67656f3f746f6b656e3d65653137313138303837303439356366656530363362383265353838343034313434316538653561)[![codecov](https://camo.githubusercontent.com/2ec8db779b42f0eb9e546e3fd1de08f32de1a3e1df2e1db2429d1ecaa9d41c31/68747470733a2f2f636f6465636f762e696f2f67682f4368696e614675747572654c696e6b2f67656f2f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d49504b303058474e4e47)](https://codecov.io/gh/ChinaFutureLink/geo)

ChinaFutureLink/GEO
===================

[](#chinafuturelinkgeo)

提供地理服务相关接口。

Installing / Getting started
----------------------------

[](#installing--getting-started)

通过Composer安装

```
composer require fu/geo 2.*

```

将下面的代码加入composer.json

```
{
    "require": {
    	"fu/geo": "2.*"
    }
}
```

Developing
----------

[](#developing)

### Building

[](#building)

```
> vendor/bin/phpcs --standard=PSR12 src
> vendor/bin/phpcbf --standard=PSR12 src
> vendor/bin/phpunit

Generating code coverage report in HTML format ... done [00:00.020]
```

Features
--------

[](#features)

### 根据经纬度查询地理位置信息

[](#根据经纬度查询地理位置信息)

```
include "./vendor/autoload.php";

use Fu\Geo\GeoCoder;
use Fu\Geo\Service\Coordinary\TencentCoordinaryLocationService;

const KEY = "YOUR-TENCENT-GEO-SERVICE-KEY";

$latitude  = 29.60001;
$longitude = 91.00001;

$service = new TencentCoordinaryLocationService(KEY);
$response = $service->getLocation($latitude, $longitude);

if ($response->isOk()) {
    $area = $response->getArea();
    $area->nation; // 中国
    $area->lv1;    // 西藏自治区
    $area->lv2;    // 拉萨市
    $area->lv3;    // 堆龙德庆区
} else {
    // get the response raw data...
    var_dump($response->getRaw());
}
```

### 根据IP地址查询地理位置信息

[](#根据ip地址查询地理位置信息)

```
include "./vendor/autoload.php";

use Fu\Geo\IpCoder;
use Fu\Geo\Service\Ip\TencentIpLocationService;

const KEY = "YOUR-TENCENT-GEO-SERVICE-KEY";

$ip = '171.221.208.34';
$service = new TencentIpLocationService(KEY);
$response = $service->getLocation($ip);

if ($response->isOk()) {
    $area = $response->getArea()
    $area->nation; // 中国
    $area->lv1;    // 四川省
    $area->lv2;    // 成都市
    $area->lv3;    // 温江区
} else {
    // get the response raw data...
    var_dump($response->getRaw());
}
```

### 根据手机号码查询地理位置信息

[](#根据手机号码查询地理位置信息)

```
include "./vendor/autoload.php";

use Fu\Geo\IpCoder;
use Fu\Geo\Service\Phone\AliPhoneLocationService;

const KEY = "YOUR-ALI-SERVICE-KEY";

$areaCode = '86';
$phone = '13880799123';
$service = new AliPhoneLocationService(KEY);
$response = $service->getLocation($areaCode, $phone);

if ($response->isOk()) {
    $area = $response->getArea()
    $area->nation; // 中国
    $area->lv1;    // 四川省
    $area->lv2;    // 成都市
    $area->lv3;    // 温江区
} else {
    // get the response raw data...
    var_dump($response->getRaw());
}
```

Links
-----

[](#links)

- 腾讯地理位置服务：
- 阿里云市场[手机归属地查询服务](https://market.aliyun.com/products/57126001/cmapi00035993.html?spm=5176.730005.result.2.508935247c8qJv&innerSource=search_%E6%89%8B%E6%9C%BA%E5%BD%92%E5%B1%9E%E5%9C%B0_%E6%89%8B%E6%9C%BA%E5%8F%B7%E5%BD%92%E5%B1%9E%E5%9C%B0%E6%9F%A5%E8%AF%A2_%E6%89%8B%E6%9C%BA%E5%8F%B7%E6%9F%A5%E8%AF%A2%E8%BF%90%E8%90%A5%E5%95%86%20-%E6%89%8B%E6%9C%BA%E5%8F%B7%E5%BD%92%E5%B1%9E%E5%9C%B0%E7%B2%BE%E5%87%86%E6%9F%A5%E8%AF%A2API%E6%8E%A5%E5%8F%A3%E3%80%90%E6%94%AF%E6%8C%81%E4%B8%89%E7%BD%91%E5%92%8C%E8%99%9A%E5%95%86%E3%80%91#sku=yuncode2999300001)

Licensing
---------

[](#licensing)

The code in this project is licensed under MIT license.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~41 days

Recently: every ~12 days

Total

24

Last Release

596d ago

Major Versions

1.0.2 → 2.0.02022-03-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a09025480246bc372877e028fa8dc57fb8aa1c7bc574f9f1901e6a578d167f5?d=identicon)[futurelink](/maintainers/futurelink)

---

Top Contributors

[![baohanddd](https://avatars.githubusercontent.com/u/3166072?v=4)](https://github.com/baohanddd "baohanddd (61 commits)")[![panxp](https://avatars.githubusercontent.com/u/7367784?v=4)](https://github.com/panxp "panxp (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chinafuturelink-geo/health.svg)

```
[![Health](https://phpackages.com/badges/chinafuturelink-geo/health.svg)](https://phpackages.com/packages/chinafuturelink-geo)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[google/cloud

Google Cloud Client Library

1.2k16.2M53](/packages/google-cloud)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[google/cloud-core

Google Cloud PHP shared dependency, providing functionality useful to all components.

343121.4M78](/packages/google-cloud-core)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.3M25](/packages/googleads-googleads-php-lib)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
