PHPackages                             labrodev/haversine - 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. labrodev/haversine

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

labrodev/haversine
==================

Utility library that provides a lightweight method to calculate the great-circle distance between two geographic coordinates using the Haversine formula.

v1.0.1(8mo ago)094↓100%MITPHPPHP &gt;=8.1

Since Jun 29Pushed 8mo agoCompare

[ Source](https://github.com/labrodev/haversine)[ Packagist](https://packagist.org/packages/labrodev/haversine)[ Docs](https://github.com/labrodev/haversine)[ RSS](/packages/labrodev-haversine/feed)WikiDiscussions main Synced today

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

PHP Haversine Distance Calculator
=================================

[](#php-haversine-distance-calculator)

**Labrodev\\Haversine** is a strict PHP 8.1+ utility library that provides a lightweight method to calculate the great-circle distance between two geographic coordinates using the Haversine formula.

Features
--------

[](#features)

- Calculates accurate distance between two latitude/longitude points
- Returns result in kilometers
- Based on the Haversine formula (spherical Earth model)
- Fully static and type-safe class
- Lightweight, dependency-free implementation
- Includes PHPUnit and PHPStan support for testing and analysis

Installation
------------

[](#installation)

```
composer require labrodev/haversine

```

Usage
-----

[](#usage)

```
use Labrodev\Haversine\Calculator;

// Distance in kilometers between Paris and Frankfurt
$distance = Calculator::haversineDistance(48.8566, 2.3522, 50.1109, 8.6821);

echo $distance; // e.g., 478.5
```

Testing
-------

[](#testing)

To run tests:

```
composer install
composer test

```

Static Analysis
---------------

[](#static-analysis)

To run static analysis using PHPStan:

```
composer install
composer analyse

```

> Configuration is located in `phpstan.neon.dist`

Security
--------

[](#security)

If you discover a security vulnerability within this package, **please contact us immediately at **. All security-related issues will be handled privately and promptly.

Credits
-------

[](#credits)

This package is maintained by **Labrodev** — Laravel &amp; PHP development studio.

Feedback
--------

[](#feedback)

If you have any questions, suggestions, or have found an error — feel free to open an issue or contact us:
****

**License:** MIT

###  Health Score

33

—

LowBetter than 77% of packages

Maintenance59

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~1 days

Total

2

Last Release

264d ago

### Community

Maintainers

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

---

Top Contributors

[![jjtbsomhorst](https://avatars.githubusercontent.com/u/583355?v=4)](https://github.com/jjtbsomhorst "jjtbsomhorst (2 commits)")[![labrodev](https://avatars.githubusercontent.com/u/151143718?v=4)](https://github.com/labrodev "labrodev (1 commits)")

---

Tags

composer-librarycomposer-packagedistance-calculationdistance-measureshaversine-distancehaversine-formulalabrodevlatitude-and-longitudephpphp-libraryphp-packagephp-utilityphp8webdevelopmentphphelperutilitystatichaversinelabrodevdistance-calculatorlatitude-longitude

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/labrodev-haversine/health.svg)

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

###  Alternatives

[zjkal/time-helper

一个简单快捷的PHP日期时间助手类库。 a smart PHP datetime helper library.

21128.6k](/packages/zjkal-time-helper)

PHPackages © 2026

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