diamonddev / laravel-geographical-calculator
Laravel package that helps you perform geographical calculation with several algorithms that help you deal with coordinates
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 32
pkg:composer/diamonddev/laravel-geographical-calculator
Requires
- php: ^8.2|^8.3|^8.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- orchestra/testbench: ^8.0|^9.0|^10.0
- phpunit/phpunit: ^10|^11|^12
- dev-main
- v2.4.1.x-dev
- v2.4.1
- 2.4.0.x-dev
- v2.4.0
- v2.3.0
- v2.2.0.x-dev
- v2.2.0
- v2.1.1.x-dev
- v2.1.1
- v2.1.0.x-dev
- v2.1.0
- v2.0.1.x-dev
- v2.0.1
- v2.0.0
- v1.1.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-analysis-e7EJ72
- dev-analysis-e7EJ0A
- dev-analysis-YjnyGj
- dev-analysis-BMvkPL
- dev-analysis-QMAJew
- dev-analysis-ADdpbk
- dev-revert-2-analysis-orVQGN
- dev-analysis-orVQGN
- dev-analysis-PxJ5jL
This package is auto-updated.
Last update: 2025-09-27 16:59:21 UTC
README
Geographical Calculator
Geographical Calculator is developed for Laravel to help you implement geographical calculation, with several algorithms that help you deal with coordinates.
Installation
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:
php artisan geo:install
Features
- Get the distance between one or more of points
- Get the center between set of points
- Get the closest point to the specific point
- Get the farthest point to the specific point
- Check if a given point located in a given area
- Get a ranking of points by the nearest neighbor algorithm
- Get all package features
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
Please see the CHANGELOG for more information about what has changed or updated or added recently.
Security
If you discover any security-related issues, please email them first to support@diamonddev.group, if we do not fix it within a short period of time, please open a new issue describing your problem.