PHP code example of karjah / laravel-geo-ip

1. Go to this page and download the library: Download karjah/laravel-geo-ip 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/ */

    

karjah / laravel-geo-ip example snippets


use Karjah\GeoIP\Facades\GeoIp;

$geoData = GeoIP::get($ipAddress);

// Getting values
$countryCode = $geoData->countryCode;

status // success or fail
country
countryCode
region
city

ip
isp

message // Only if status = fail