PHP code example of najibismail / multigeoip

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

    

najibismail / multigeoip example snippets


use Najibismail\MultiGeoip\Facades\Multigeoip;

// Auto get an IP Address
$ip_info = Multigeoip::ip();

// [OR]

// Set the IP Address
$ip_info = Multigeoip::ip('{IP ADDRESS}');

// Get the IP Address details
$ip_info->all(); 
$ip_info->getIp();
$ip_info->getCountryCode();
$ip_info->getCountry();
$ip_info->getCity();
$ip_info->getZipCode();
$ip_info->getState();
$ip_info->getTimezone();



// Auto get an IP Address
$ip_info = multigeoip();

// [OR]

// Set the IP Address
$ip_info = multigeoip('{IP ADDRESS}');

// Get the IP Address details
$ip_info->all(); 
$ip_info->getIp();
$ip_info->getCountryCode();
$ip_info->getCountry();
$ip_info->getCity();
$ip_info->getZipCode();
$ip_info->getState();
$ip_info->getTimezone();

php artisan multigeoip:publish

php artisan multigeoip:maxmind-db