Resolve a client's location and travel distance through pluggable geolocation providers for Laravel.
roundly-consulting/geolocation-for-laravel is a Laravel package for resolve a client's location and travel distance through pluggable geolocation providers for laravel..
It currently has 0 GitHub stars and 203 downloads on Packagist (latest version 2.0.4).
Install it with composer require roundly-consulting/geolocation-for-laravel.
Discover more Laravel packages by roundly-consulting
or browse all Laravel packages to compare alternatives.
Last updated
Resolve a client's location from an IP address, coordinates or a street address, and the travel
distance between two points, through a pluggable pipeline of providers: IPinfo, IP2Location,
Google, MaxMind (with a native .mmdb reader) and a configurable fallback.
Requires PHP 8.4 and Laravel 12 or 13.
composer require roundly-consulting/geolocation-for-laravel
IP lookups work out of the box through IP2Location and IPinfo. Address lookups and distances go
through Google and need GOOGLE_MAPS_API_KEY in your .env, with the Geocoding API and the
Routes API enabled on that key.
Locate the visitor, geocode an address and measure a drive, all through the facade:
use RoundlyConsulting\Geolocation\DataTransferObjects\Coordinates;
use RoundlyConsulting\Geolocation\Enum\DistanceType;
use RoundlyConsulting\Geolocation\Facades\Geolocation;
$location = Geolocation::locateRequest(); // the client's IP; null when nothing resolves
$location?->city; // "Mountain View"
$location?->countryIsoCode; // "US"
$location?->timezone; // "America/Los_Angeles"
$office = Geolocation::locateAddress('1600 Amphitheatre Pkwy, Mountain View');
$office?->coordinates(); // Coordinates(37.4224, -122.0841)
$distance = Geolocation::distanceBetween(
new Coordinates(48.1482, 17.1067),
new Coordinates(49.2000, 16.6068),
DistanceType::Driving,
);
$distance?->humanReadableDistance; // "133 km"
$distance?->durationInSeconds; // 5400
The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/geolocation-for-laravel
Release notes are in CHANGELOG.md. To contribute, see the contributing guide.
This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.
The MIT License (MIT). See LICENSE.md.