PHP code example of abstractapi / php-ip-geolocation

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

    

abstractapi / php-ip-geolocation example snippets


// Get a Geolocation from an IP Address Abstract's IP Geolocation API and PHP

$api_key = "YYYYYY"; // Your API Key from https://app.abstractapi.com/api/ip-geolocation/documentation

Abstractapi\IpGeolocation\AbstractIpGeolocation::configure($api_key);

$info = Abstractapi\IpGeolocation\AbstractIpGeolocation::look_up('8.8.8.8');

print $info->city;

bash
composer 
bash
php vendor/bin/phpunit