PHP code example of geocoder-php / geoip2-provider

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

    

geocoder-php / geoip2-provider example snippets

bash
composer 
 php
// Use the Maxmind GeoIP2 API:
$reader = new \GeoIp2\WebService\Client(<account_id>, '<licence_key>');

$adapter = new \Geocoder\Provider\GeoIP2\GeoIP2Adapter($reader);
$geocoder = new \Geocoder\Provider\GeoIP2\GeoIP2($adapter);

$address = $geocoder->geocodeQuery(\Geocoder\Query\GeocodeQuery::create('74.200.247.59'))->first();