PHPackages                             cocoyo/geography - 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. [API Development](/categories/api)
4. /
5. cocoyo/geography

ActiveLibrary[API Development](/categories/api)

cocoyo/geography
================

geographic position api

v0.1(8y ago)5271MITPHP

Since Sep 17Pushed 8y agoCompare

[ Source](https://github.com/ningge123/geography)[ Packagist](https://packagist.org/packages/cocoyo/geography)[ RSS](/packages/cocoyo-geography/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (2)Used By (0)

geography
=========

[](#geography)

根据ip地址获取地址位置信息,这是基于百度api开放接口，使用前需要[申请密钥（AK）](http://lbsyun.baidu.com/apiconsole/key?application=key).

使用
==

[](#使用)

这是一个标准的`composer`包:

`composer require cocoyo/geography`

laravel中使用:

```
 在cofig/services.php中添加配置

 'baidu' => [
         'ak' => '你的ak'
     ],

 Cocoyo\Geography\GeographyServiceProvider::class,注册服务提供者

 app('geography')->position($ip);

 或者使用依赖注入形式使用

```

一般项目中使用:

```
require './vendor/autoload.php';

$gegoraphy = new \Cocoyo\Geography\Geography(['ak' => '你的ak']);

$info = $gegoraphy->position('220.181.108.99');

```

返回内容

```
Array
(
    [address_detail] => Array
        (
            [province] => 广东省
            [city] => 深圳市
            [district] =>
            [street] =>
            [street_number] =>
            [city_code] => 340
        )

    [address] => 广东省深圳市
    [point] => Array
        (
            [y] => 2560682.35
            [x] => 12693451.44
        )

)

```

嗯！暂时还没做单元测试，后期补上。。

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3160d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8bccd40a512d8c9e9b15c8155bd7ef1ee24e100629209df858483812fbe4a03a?d=identicon)[ningge123](/maintainers/ningge123)

---

Top Contributors

[![ningge123](https://avatars.githubusercontent.com/u/21093697?v=4)](https://github.com/ningge123 "ningge123 (8 commits)")

### Embed Badge

![Health badge](/badges/cocoyo-geography/health.svg)

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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