ivoglent/ip2c

There is no license information available for the latest version (1.0.0) of this package.

Convert IP address to country code or name

Maintainers

Details

github.com/ivoglent/ip2c

Source

Issues

Installs: 12

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/ivoglent/ip2c

1.0.0 2019-08-30 02:45 UTC

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;
}