### Install with Composer Source: https://github.com/roundly-consulting/geolocation-for-laravel/blob/main/README.md Install the package using Composer. Requires PHP 8.4 and Laravel 12 or 13. ```bash composer require roundly-consulting/geolocation-for-laravel ``` -------------------------------- ### Use Geolocation facade for IP, address, and distance lookups Source: https://github.com/roundly-consulting/geolocation-for-laravel/blob/main/README.md Example usage of the Geolocation facade to locate the client's IP, geocode an address, and calculate driving distance between two coordinates. IP lookups work out of the box; address and distance require GOOGLE_MAPS_API_KEY with Geocoding and Routes APIs enabled. ```php 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 ```