PHP code example of ndevs-eu / geo-ip-bundle

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

    

ndevs-eu / geo-ip-bundle example snippets


$geoData = $request->attributes->get('geoIp');

if ($geoData) {
    $country = $geoData['country'];
    $city = $geoData['city'];
}
bash
php bin/console geoip:pull-maxmind-database
bash
php bin/console geoip:pull-ip2loc-lite-database