PHPackages                             diamonddev/laravel-geographical-calculator - 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. diamonddev/laravel-geographical-calculator

ActiveLibrary

diamonddev/laravel-geographical-calculator
==========================================

Laravel package that helps you perform geographical calculation with several algorithms that help you deal with coordinates

v2.4.1(8mo ago)10MITPHPPHP ^8.2|^8.3|^8.4CI passing

Since Nov 20Pushed 8mo agoCompare

[ Source](https://github.com/diamonddevgroup/laravel-geographical-calculator)[ Packagist](https://packagist.org/packages/diamonddev/laravel-geographical-calculator)[ RSS](/packages/diamonddev-laravel-geographical-calculator/feed)WikiDiscussions main Synced 1mo ago

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

[![logo](assets/logo.png)](assets/logo.png)

Geographical Calculator
-----------------------

[](#geographical-calculator)

[![PHP composer](https://github.com/diamonddevgroup/laravel-geographical-calculator/actions/workflows/php.yml/badge.svg)](https://github.com/diamonddevgroup/laravel-geographical-calculator/actions/workflows/php.yml)[![Check & fix styling](https://github.com/diamonddevgroup/laravel-geographical-calculator/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/diamonddevgroup/laravel-geographical-calculator/actions/workflows/php-cs-fixer.yml)[![Unit tests](https://github.com/diamonddevgroup/laravel-geographical-calculator/actions/workflows/tests.yml/badge.svg)](https://github.com/diamonddevgroup/laravel-geographical-calculator/actions/workflows/tests.yml)[![Latest stable version](https://camo.githubusercontent.com/bbc2a57f49feec2d20f014bc38c226206a8fb8bd1d14814321d6153a3e108e42/687474703a2f2f706f7365722e707567782e6f72672f6469616d6f6e646465762f6c61726176656c2d67656f67726170686963616c2d63616c63756c61746f722f76)](https://packagist.org/packages/diamonddev/laravel-geographical-calculator)[![PHP version require](https://camo.githubusercontent.com/6c904259d23667b1545367a16d810a09f443e7279930097ab9c5375703f98a7f/687474703a2f2f706f7365722e707567782e6f72672f6469616d6f6e646465762f6c61726176656c2d67656f67726170686963616c2d63616c63756c61746f722f726571756972652f706870)](https://packagist.org/packages/diamonddev/laravel-geographical-calculator)[![Latest unstable version](https://camo.githubusercontent.com/cd3753fb58350745e02db24eaba3edf656cc08b37b093a334884db4384c3743e/687474703a2f2f706f7365722e707567782e6f72672f6469616d6f6e646465762f6c61726176656c2d67656f67726170686963616c2d63616c63756c61746f722f762f756e737461626c65)](https://packagist.org/packages/diamonddev/laravel-geographical-calculator)[![Total downloads](https://camo.githubusercontent.com/b7fd1448c0d115137cb8b47a26daa70b8b62440c8ddda660656be4819ee86e61/687474703a2f2f706f7365722e707567782e6f72672f6469616d6f6e646465762f6c61726176656c2d67656f67726170686963616c2d63616c63756c61746f722f646f776e6c6f616473)](https://packagist.org/packages/diamonddev/laravel-geographical-calculator)[![License](https://camo.githubusercontent.com/cce322313d52e1aa0f0126dbf202c4c0558859c14ff6236b57910fd57ed894b3/687474703a2f2f706f7365722e707567782e6f72672f6469616d6f6e646465762f6c61726176656c2d67656f67726170686963616c2d63616c63756c61746f722f6c6963656e7365)](https://packagist.org/packages/diamonddev/laravel-geographical-calculator)

Geographical Calculator is developed for Laravel to help you implement geographical calculation, with several algorithms that help you deal with coordinates.

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

[](#installation)

##### 1 - Dependency

[](#1---dependency)

The first step is using composer to install the package and automatically update your `composer.json` file, you can do this by running:

```
composer require diamonddev/laravel-geographical-calculator
```

##### 2 - Copy the package providers to your local config with the publish command, this will publish the config:

[](#2---copy-the-package-providers-to-your-local-config-with-the-publish-command-this-will-publish-the-config)

```
php artisan geo:install
```

Features
--------

[](#features)

- [Get the distance between one or more of points](docs/distances.md#basic-usage)
- [Get the center between set of points](docs/areas.md#get-the-center-for-a-given-coordinates)
- [Get the closest point to the specific point](docs/ordering.md#get-closest-point)
- [Get the farthest point to the specific point](docs/ordering.md#get-farthest-point)
- [Check if a given point located in a given area](docs/areas.md#check-if-a-given-point-located-in-a-given-area)
- [Get a ranking of points by the nearest neighbor algorithm](docs/ordering.md#get-ordering-points-by-nearest-neighbor-algorithm)
- [Get all package features](docs/all.md#all-features-in-one-function)

Config options
--------------

[](#config-options)

> Add your custom units, keys, etc.

```
    /*
    |--------------------------------------------------------------------------
    | units values
    |--------------------------------------------------------------------------
    | your custom units, the initial units its convert from a mile to any value
    | (1.609344) is the conversion factor from a mile to a kilometer
    */
    'units' => [
        'mile' => 1,
        'km' => 1.609344,
        'm' => (1.609344 * 1000),
        'cm' => (1.609344 * 100),
        'mm' => (1.609344 * 1000 * 1000),
    ],

    /*
    |--------------------------------------------------------------------------
    | distance_key_prefix
    |--------------------------------------------------------------------------
    | if you declared more than tow points to resolve their distance,
    | you will see the result in the following format:
    | "1-2" => ["km" => "some result"],
    | "2-3" => ["km" => "some result"],
    | "3-4" => ["km" => "some result"],
    | and if you want to set any prefix before each index
    | you must change the below value to any value you want.
    |
    */
    'distance_key_prefix' => '',
```

Changelog
---------

[](#changelog)

Please see the [CHANGELOG](CHANGELOG.md) for more information about what has changed or updated or added recently.

Security
--------

[](#security)

If you discover any security-related issues, please email them first to , if we do not fix it within a short period of time, please open a new issue describing your problem.

Credits
-------

[](#credits)

[Karam Mustafa](https://www.linkedin.com/in/karam2mustafa)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance59

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 91.6% 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 ~96 days

Recently: every ~43 days

Total

19

Last Release

259d ago

Major Versions

v1.1.0 → v2.0.02021-12-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/17b26cb55a1e51893fe822c996aca69fc96a09517506c7caca2ff025f18deec8?d=identicon)[diamondobama](/maintainers/diamondobama)

---

Top Contributors

[![karam-mustafa](https://avatars.githubusercontent.com/u/71431942?v=4)](https://github.com/karam-mustafa "karam-mustafa (208 commits)")[![diamondobama](https://avatars.githubusercontent.com/u/7268931?v=4)](https://github.com/diamondobama "diamondobama (17 commits)")[![iambateman](https://avatars.githubusercontent.com/u/1709997?v=4)](https://github.com/iambateman "iambateman (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/diamonddev-laravel-geographical-calculator/health.svg)

```
[![Health](https://phpackages.com/badges/diamonddev-laravel-geographical-calculator/health.svg)](https://phpackages.com/packages/diamonddev-laravel-geographical-calculator)
```

PHPackages © 2026

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