PHP code example of hamidreza2005 / php-ip

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

    

hamidreza2005 / php-ip example snippets

    
use hamidreza2005\phpIp\Geojs;
use hamidreza2005\phpIp\Ipinfo;
use hamidreza2005\phpIp\Ipapi;

$ip = new Geojs($DebugMode,$IP); //visit https://www.geojs.io/
$ip = new Ipapi(API_TOKEN,$DebugMode,$IP); // visit https://www.ipapi.com/
$ip = new Ipinfo(API_TOKEN,$JSON_FILE_PATH,$DebugMode,$IP); // visit https://www.ipinfo.io/
    
$ip->countryCode() // return country Code e.g DE    
$ip->all() // return all Details about client's ip    
$ip->coordinates() // return client's coordinates    
$ip->ip() // return all client's ip    
$ip->country() // return all client's country full name e.g Germany    
  
  
use hamidreza2005\phpIp\Ipapi;
$ip = new Ipinfo(API_TOKEN,"./file/path.json")
bash    
composer