1. Go to this page and download the library: Download lithiumdev/larageo-plugin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$info = LaraGeo::getInfo('177.34.13.248'); // get info from a IP
var_dump($info);
$info = LaraGeo::getInfo(); // get info from the IP of the user accessing the page
var_dump($info);
object(stdClass)[155]
public 'geoplugin_request' => string '177.34.13.248' (length=13)
public 'geoplugin_status' => int 200
public 'geoplugin_credit' => string 'Some of the returned data ublic 'geoplugin_dmaCode' => string '0' (length=1)
public 'geoplugin_countryCode' => string 'BR' (length=2)
public 'geoplugin_countryName' => string 'Brazil' (length=6)
public 'geoplugin_continentCode' => string 'SA' (length=2)
public 'geoplugin_latitude' => string '-20.450001' (length=10)
public 'geoplugin_longitude' => string '-54.616699' (length=10)
public 'geoplugin_regionCode' => string '11' (length=2)
public 'geoplugin_regionName' => string 'Mato Grosso do Sul' (length=18)
public 'geoplugin_currencyCode' => string 'BRL' (length=3)
public 'geoplugin_currencySymbol' => string 'R$' (length=10)
public 'geoplugin_currencySymbol_UTF8' => string 'R$' (length=2)
public 'geoplugin_currencyConverter' => float 2.383
$userCity = LaraGeo::getInfo()->geoplugin_city; // get the city from the user IP
var_dump($userCity);
string 'Campo Grande' (length=12)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.