ivoglent / ip2c
Convert IP address to country code or name
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ivoglent/ip2c
This package is auto-updated.
Last update: 2025-09-29 02:00:23 UTC
README
Detect location of an IP live area, country code and country name.
Usage
require 'vendor/autoload.php'; use ivoglent\ip2c\IpLocator; $ip = '186.95.255.255; $ipLocator = new IpLocator($ip); if ($ipLocator->analysis()) { echo sprintf('%s : %s, %s, %s', $ip, $ipLocator->getArea(), $ipLocator->getCountryCode(), $ipLocator->getCoutryName()) . PHP_EOL; } else { echo 'Can not detect this IP address' . PHP_EOL; }