PHPackages                             chency147/geohash - 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. chency147/geohash

ActiveLibrary

chency147/geohash
=================

A util to transform a pair of longitude and latitude to geohash.

0.0.1(9y ago)5643MITPHPPHP &gt;=5.4.0

Since Mar 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/chency147/geohash)[ Packagist](https://packagist.org/packages/chency147/geohash)[ Docs](https://github.com/chency147/GeoHash)[ RSS](/packages/chency147-geohash/feed)WikiDiscussions master Synced 1mo ago

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

GeoHash工具类
==========

[](#geohash工具类)

简介
--

[](#简介)

本工具类整合Geohash的编码和解码功能，即GeoHash和经纬度之间的转换。采用GeoHash的目的是为了提高周边搜索的速度，特别适用于查询周边多少千米内所有商户这样的应用场景。

使用方法
----

[](#使用方法)

### 编码

[](#编码)

```
$geohash = new GeoHash();
$hash = $geohash->encode(120.20000, 30.26667);
// 变量$hash的值为'wtmkpjyuph'。
```

### 解码

[](#解码)

```
$geohash = new GeoHash();
$result = $geohash->decode('wtmkpjyuph');
// 变量$result为一数组，$result[0]为经度，$result[1]为纬度。
```

### 获取周边8个矩阵的GeoHash

[](#获取周边8个矩阵的geohash)

```
$geohash = new GeoHash();
$hash = 'wx4g0b';
$neighbors = $this->geoHash->neighbors($hash);
/*
结果如下
$neighbors = array(
    'North' => 'wx4g0c',
    'NorthEast' => 'wx4g11',
    'East' => 'wx4g10',
    'SouthEast' => 'wx4fcp',
    'South' =>'wx4fbz',
    'SouthWest' =>  'wx4fbx',
    'West' => 'wx4g08',
    'NorthWest' => 'wx4g09',
);
*/
```

协议
--

[](#协议)

本项目采用[MIT](https://opensource.org/licenses/MIT)协议。

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

3334d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/912c5042d2b9543e49dcaa4ed5b344fe62ec6816a63a0e7d93b760789f981055?d=identicon)[chency147](/maintainers/chency147)

---

Top Contributors

[![chency147](https://avatars.githubusercontent.com/u/13692301?v=4)](https://github.com/chency147 "chency147 (5 commits)")

---

Tags

geohash

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chency147-geohash/health.svg)

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

###  Alternatives

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[lvht/geohash

geohash like python-geohash

77580.2k1](/packages/lvht-geohash)[toin0u/geotools

Geo-related tools PHP 7.3+ library

1.4k1.3k](/packages/toin0u-geotools)[saikiran/geohash

Geohash Algorithm to encode geographic coordinates to a string of letters and digits

44456.6k3](/packages/saikiran-geohash)[laravie/geotools

Geo-related tools PHP 7+ library

19105.4k1](/packages/laravie-geotools)[camcima/php-geohash

Refactored GeoHash package

1074.0k](/packages/camcima-php-geohash)

PHPackages © 2026

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