PHP code example of tiran133 / ipinfodb-php

1. Go to this page and download the library: Download tiran133/ipinfodb-php 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/ */

    

tiran133 / ipinfodb-php example snippets


composer 

php artisan vender:publish --provider="Tiran133\Laravel\IPInfoDBServiceProvider"

$country = \Tiran133\Laravel\Facade\IPInfo::getCountry($ip);
 
$country->countryName;
$country->countryCode;

$city = \Tiran133\Laravel\Facade\IPInfo::getCity($ip);
 
$city->countryName;
$city->countryCode;
$city->regionName;
$city->cityName;
$city->zipCode;
$city->latitude;
$city->longitude;
$city->timeZone;


$ipinfo =  app('ipinfodb');
$country = $ipinfo->getCountry($ip);     
 
$country->countryName;
$country->countryCode;


$city = \Tiran133\Laravel\Facade\IPInfo::getCity($ip);
 
$city->countryName;
$city->countryCode;
$city->regionName;
$city->cityName;
$city->zipCode;
$city->latitude;
$city->longitude;
$city->timeZone;