PHPackages                             roslov/location - 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. roslov/location

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

roslov/location
===============

Location calculator

1.0.0(2y ago)013[2 issues](https://github.com/roslov/location/issues)MITPHPPHP ^7.2|^8.0

Since Jan 17Pushed 2y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Location Calculator
===================

[](#location-calculator)

[![Latest Stable Version](https://camo.githubusercontent.com/4efbf2dfc10793f43a602c52a7a1c220d4071c55aa03ccbd9488261915007b94/687474703a2f2f706f7365722e707567782e6f72672f726f736c6f762f6c6f636174696f6e2f76)](https://packagist.org/packages/roslov/location)[![Total Downloads](https://camo.githubusercontent.com/1013bf0c269dffbe6edb0118c34749885749a6aba6ca198fda0022a296f8b5bd/687474703a2f2f706f7365722e707567782e6f72672f726f736c6f762f6c6f636174696f6e2f646f776e6c6f616473)](https://packagist.org/packages/roslov/location)[![Latest Unstable Version](https://camo.githubusercontent.com/e87531e5c68e3ab6b9933638ff663d7b16bb80e555675de4a4350fd9d73bd12b/687474703a2f2f706f7365722e707567782e6f72672f726f736c6f762f6c6f636174696f6e2f762f756e737461626c65)](https://packagist.org/packages/roslov/location)[![License](https://camo.githubusercontent.com/b550c26b57dcc26ec08fef386df83e0c8f1cd4dbe7cda10492b6df80526d38c9/687474703a2f2f706f7365722e707567782e6f72672f726f736c6f762f6c6f636174696f6e2f6c6963656e7365)](https://packagist.org/packages/roslov/location)[![PHP Version Require](https://camo.githubusercontent.com/23b76b58188464ef872eeb86ef1809626a0eec8ad0a25530eeafabad8775dd03/687474703a2f2f706f7365722e707567782e6f72672f726f736c6f762f6c6f636174696f6e2f726571756972652f706870)](https://packagist.org/packages/roslov/location)

This package provides calculations based on longitude and latitude.

Features
--------

[](#features)

It calculates distance between two locations.

It uses the “haversine” formula to calculate the great-circle distance between two points — that is, the shortest distance over the earth’s surface — giving an “as-the-crow-flies” distance between the points.

Formula:

```
a = sin²( Δφ / 2 ) + cos φ1 × cos φ2 × sin²( Δλ / 2 )
c = 2 × atan2( √a, √( 1 − a ) )
d = R × c

```

where `φ` is latitude, `λ` is longitude, `R` is the earth’s radius (mean radius = 6371 km).

Requirements
------------

[](#requirements)

- PHP 7.2 or higher.

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

[](#installation)

The package could be installed with composer:

```
composer require roslov/location
```

General usage
-------------

[](#general-usage)

Validator allows to check data in any format. For example, when data is an object:

```
use Roslov\Location\LocationCalculator;

$locationCalculator = new LocationCalculator();
$distance = $locationCalculator->getDistance(49.841905, 24.031511, 50.450885, 30.522798);
echo $distance; // 467.32327173219
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

897d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/464fc58072b48a348a355eeca35b6fe2e341fd494b4ffb8e30f2007c3a2a6ad5?d=identicon)[tr](/maintainers/tr)

---

Top Contributors

[![roslov](https://avatars.githubusercontent.com/u/6573063?v=4)](https://github.com/roslov "roslov (1 commits)")

---

Tags

locationcalculatorlatitudelongitude

### Embed Badge

![Health badge](/badges/roslov-location/health.svg)

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

###  Alternatives

[anthonymartin/geo-location

Powerful GeoCoding library: Retrieve bounding box coordinates, distances between geopoints, point in polygon, get longitude and latitude from addresses and more with GeoLocation for PHP

1961.0M11](/packages/anthonymartin-geo-location)[php-coord/php-coord

PHPCoord is a PHP library to aid in handling coordinates. It can convert coordinates for a point from one system to another and also calculate distance between points.

109996.7k12](/packages/php-coord-php-coord)[ballen/distical

A distance (Lat/Long) calculation library for PHP

40199.2k2](/packages/ballen-distical)[data-values/geo

Geographical value objects, parsers and formatters

20654.5k22](/packages/data-values-geo)[laravie/geotools

Geo-related tools PHP 7+ library

18136.3k1](/packages/laravie-geotools)

PHPackages © 2026

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