wakumaku / ip2c
Small and simple library to resolve the country where an Ip comes from.
Installs: 484
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/wakumaku/ip2c
Requires
- ext-curl: *
Requires (Dev)
- phpunit/phpunit: 4.5.1
This package is not auto-updated.
Last update: 2025-12-17 00:59:17 UTC
README
Ip2c is a small php library to retrieve the country where an Ip comes from.
This library uses http://ip2c.org as a service.
Installation
Prerequisites
Ip2c requires PHP 5.3.3 or greater.
If you want to run the tests you'll need a greater one (>=5.5)
Setup through composer
First, add Ip2c to the list of dependencies inside your composer.json:
{
"require": {
"wakumaku/ip2c": "dev-master"
}
}
Composer update:
$> composer update
How to use it
include vendor/autoload.php'; $ip2c = \Ip2c\Ip2cFactory::build(); $result = $ip2c->self(); echo "Status: " . $result->status() . "\n"; echo "Iso2: " . $result->iso2() . "\n"; echo "Iso3: " . $result->iso3() . "\n"; echo "Name: " . $result->name() . "\n";
Output:
Status: 1
Iso2: ES
Iso3: ESP
Name: Spain