PHPackages                             igzard/php-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. igzard/php-geohash

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

igzard/php-geohash
==================

Geohash calculation in PHP

v1.0.1(1y ago)3189MITPHPPHP ^8.3.0

Since Jan 21Pushed 1y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

php-geohash
===========

[](#php-geohash)

🌐 **Geohash** calculation in PHP

 [![Tests passed](https://camo.githubusercontent.com/df7ead99301b49147cc6070741111353b5901f59a9c808f8257a69cef9846a54/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f69677a6172642f7068702d67656f686173682f74657374732e796d6c3f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/igzard/php-geohash/actions/workflows/tests.yml) [![Total Downloads](https://camo.githubusercontent.com/eaead2fa177a58d0d86e9ec6a390543f507fe3795d1435fb0ab6271a84495bf0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f69677a6172642f7068702d67656f68617368)](https://packagist.org/packages/igzard/php-geohash) [![Latest Version](https://camo.githubusercontent.com/aa7321ea1662038c3f77e7cfa0aa24e2354de2d2b7037ff1adf59b0e907155c8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69677a6172642f7068702d67656f68617368)](https://packagist.org/packages/igzard/php-geohash)

The **PHP Geohash Generator** is a simple yet powerful tool that converts geographic coordinates (latitude and longitude) into a compact and highly useful **geohash** string. Perfect for efficiently storing, searching, and managing spatial data in your applications! 🚀

---

What is a Geohash? 🤔
--------------------

[](#what-is-a-geohash-)

A geohash is an algorithm that divides the Earth into progressively smaller "boxes" and encodes the coordinates as a text string.

- **In short:** A geohash is a single string representation of a specific location on Earth.
- **Benefits:**
    - Compact and human-readable format.
    - Easy to compare: if two locations are close, their geohashes share the same prefix.
    - Ideal for fast searches and spatial grouping.

---

Why use this library? 🎯
-----------------------

[](#why-use-this-library-)

- **Easy to use**: Simply provide latitude and longitude, and get a geohash in return.
- **Precision-focused**: The algorithm supports up to 12-character geohashes for highly accurate encoding.
- **Perfect for location-based applications**: Whether storing spatial data, searching for locations, or displaying maps, this tool gets the job done efficiently.

---

---

Installation &amp; Usage 🛠️
---------------------------

[](#installation--usage-️)

> **Requires [PHP 8.3+](https://php.net/releases/)**

```
composer require igzard/php-geohash
```

```
use Igzard\Geohash\Geohash;

// Generate a geohash for a specific location with latitude and longitude coordinates.
echo Geohash::generate(47.497913, 19.040236); // input: Budapest coordinates | output: u2mw1q8xmssz

// Generate a geohash with custom precision (default is 12), latitude interval, and longitude interval.
echo Geohash::generate(47.497913, 19.040236, [
    'precision' => 10,
    'latitude_interval' => [
        'min' => -70,
        'max' => 10,
    ],
    'longitude_interval' => [
        'min' => -80,
        'max' => 170,
    ],
]);
```

Contributing 🤝
--------------

[](#contributing-)

Thank you for considering contributing to the **Geohash PHP** library! 🎉 Here is some tooling to help you get started:

✅ Run **Code quality** check:

```
make code-quality
```

👷 Run **PHPUnit** tests:

```
make phpunit
```

🎨 Run **php-cs-fixer**:

```
make php-cs-fixer
```

🔥 Run **phpstan**:

```
make phpstan
```

🚀 Install dependencies with **composer**:

```
make composer-install
```

**Geohash PHP** was created by **[Gergely Ignácz](https://x.com/igz4rd)** under the **[MIT license](https://opensource.org/licenses/MIT)**.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance42

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Every ~0 days

Total

2

Last Release

472d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/edf561191867ffdeb3b9d6d58cad673300a26d4523cb0e0e169da75a59c4da0f?d=identicon)[igzard](/maintainers/igzard)

---

Top Contributors

[![igzard](https://avatars.githubusercontent.com/u/10142225?v=4)](https://github.com/igzard "igzard (3 commits)")

---

Tags

phppackagegeohash

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[camcima/php-geohash

Refactored GeoHash package

1074.0k](/packages/camcima-php-geohash)[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

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