PHPackages                             dynamicscreen/laravel-geographical - 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. [Framework](/categories/framework)
4. /
5. dynamicscreen/laravel-geographical

AbandonedArchivedLibrary[Framework](/categories/framework)

dynamicscreen/laravel-geographical
==================================

Easily add longitude and latitude columns to your records and use inherited functionality for calculating distances

1.0.2(6y ago)0252MITPHPPHP &gt;=5.6.4

Since Oct 1Pushed 6y agoCompare

[ Source](https://github.com/DynamicScreen/Laravel-Geographical)[ Packagist](https://packagist.org/packages/dynamicscreen/laravel-geographical)[ RSS](/packages/dynamicscreen-laravel-geographical/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Laravel Geographical
====================

[](#laravel-geographical)

Easily add longitude and latitude columns to your records and use inherited functionality for calculating distances.

First either update your database or add this to a migration for each model:

```
$table->double('longitude');
$table->double('latitude');
```

Finally in your model use:

```
use Geographical;
```

### 1. Distance

[](#1-distance)

Find the distance to all the entries in your table from a particular location.

```
$query = Model::distance($latitude, $longitude);
$asc = $query->orderBy('distance', 'ASC')->get();
```

### 2. Geofence

[](#2-geofence)

Find all the entries in your table inside a circular geo-fence.

```
$query = Model::geofence($latitude, $longitude, $inner_radius, $outer_radius);
$all = $query->get();
```

### Units

[](#units)

The default unit of distance is **miles**. You can change it to **kilometers** by putting this in your model

```
protected static $kilometers = true;
```

### Notes

[](#notes)

1. The method returns a `Eloquent\Builder` object so that you can add optional conditions if you want.
2. You can use `distance` as an aggregate column in the result. (Aggregate columns cannot be used in `WHERE`, use `HAVING` to execute any condition.)
3. If you use different column names for latitude and longitude, mention them in the Model.php

```
const LATITUDE  = 'lat';
const LONGITUDE = 'lng';
```

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

[](#installation)

[PHP](https://php.net) 5.6.4+ and [Laravel](http://laravel.com) 5+ are required.

To get the latest version of Laravel Geographical, simply require the project using [Composer](https://getcomposer.org):

```
$ composer require malhal/laravel-geographical
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 76.9% 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 ~538 days

Total

3

Last Release

2482d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2768401?v=4)[Marty Lamoureux](/maintainers/martylamoureux)[@martylamoureux](https://github.com/martylamoureux)

![](https://avatars.githubusercontent.com/u/33919928?v=4)[Corentin](/maintainers/cormarti)[@cormarti](https://github.com/cormarti)

---

Top Contributors

[![malhal](https://avatars.githubusercontent.com/u/916912?v=4)](https://github.com/malhal "malhal (10 commits)")[![ashnehete](https://avatars.githubusercontent.com/u/7398393?v=4)](https://github.com/ashnehete "ashnehete (2 commits)")[![xitude](https://avatars.githubusercontent.com/u/3580195?v=4)](https://github.com/xitude "xitude (1 commits)")

---

Tags

frameworklaravelusermodelsgeographicallatitudelongitudeMalcolm HallmalhalLaravel Geographical

### Embed Badge

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

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

###  Alternatives

[malhal/laravel-geographical

Easily add longitude and latitude columns to your records and use inherited functionality for calculating distances

283391.5k](/packages/malhal-laravel-geographical)[laravel/laravel

The skeleton application for the Laravel framework.

84.6k62.4M1.0k](/packages/laravel-laravel)[unopim/unopim

UnoPim Laravel PIM

10.5k2.2k](/packages/unopim-unopim)[digitalcloud/laravel-postgis

121.9k](/packages/digitalcloud-laravel-postgis)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[akuechler/laravel-geoly

Perform fast and efficient radius searches on your Laravel Eloquent models.

4161.5k](/packages/akuechler-laravel-geoly)

PHPackages © 2026

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