Get location with user ip — Laravel Package

--

  1. Add package to composer .json —
"stevebauman/location": "^6.1"

2. Use location —

$location = Stevebauman\Location\Facades\Location::get(request()->ip());

3. Now you can find object like this —

Stevebauman\Location\Position Object
(
[countryName] =>
[countryCode] => US
[regionCode] =>
[regionName] => California
[cityName] => Mountain View
[zipCode] => 94043
[isoCode] =>
[postalCode] =>
[latitude] => 37.4192
[longitude] => -122.0574
[metroCode] =>
[areaCode] =>
[driver] => Stevebauman\Location\Drivers\IpInfo
)

--

--