PHP code example of netglue / geoip2-helpers
1. Go to this page and download the library: Download netglue/geoip2-helpers 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/ */
netglue / geoip2-helpers example snippets
$ip = $this->clientIp(); // If you are using the netglue/realip-helpers dependency
if ($ip) {
$countryCode = $this->geoIp()->countryCode($ip);
$countryName = $this->geoIp()->countryName($ip);
$timezone = $this->geoIp()->timezone($ip); // If you are using the City Database
$dataArray = $this->geoIp()->get($ip);
}