igzard/php-geohash
最新稳定版本:v1.0.1
Composer 安装命令:
composer require igzard/php-geohash
包简介
Geohash calculation in PHP
README 文档
README
🌐 Geohash calculation in PHP
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? 🤔
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? 🎯
- 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 & Usage 🛠️
Requires PHP 8.3+
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 🤝
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 under the MIT license.
统计信息
- 总下载量: 156
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-21