Your go-to IP-to-Geo cloud service — fast, accurate, and built for developers. Start free with 1,000 monthly stored conversions.
Website • Dashboard • Documentation • Services Status
This package provides a lightweight, zero-dependency way to integrate Ip2Geo into your PHP applications.
- PHP 8.0 or higher
- ext-curl
- ext-json
composer require ip2geo-dev/sdkuse Ip2Geo\Ip2Geo;
Ip2Geo::init('your-api-key');You may also pass options:
Ip2Geo::init('your-api-key', [
'version_update_message' => true,
'cache' => true,
'cache_max_size' => 1000,
'cache_ttl' => 300,
]);use Ip2Geo\Ip2Geo;
$convertedIp = Ip2Geo::convertIp('8.8.8.8');
$convertedIps = Ip2Geo::convertIps([
'8.8.8.8',
'1.1.1.1',
'9.9.9.9',
'64.6.64.6',
]);
// [
// 'success' => true,
// 'code' => 200,
// 'message' => 'Success',
// 'data' => [ ... ],
// '_req' => [
// 'reqId' => 'string',
// 'resTime' => 123,
// ],
// ]$conversion = Ip2Geo::getConversion('conversion-id');
$conversions = Ip2Geo::getConversions(['id-a', 'id-b']);
$list = Ip2Geo::listConversions(0, 50);$conversion = Ip2Geo::getConversion('conversion-id', [
Ip2Geo::SELECT['IP'],
Ip2Geo::SELECT['COUNTRY_NAME'],
]);$result = Ip2Geo::ipValidation('8.8.8.8');
// ['ip4' => true, 'ip6' => false]- Zero runtime dependencies (uses PHP built-ins only)
- Static facade — no instantiation required
- Built-in LRU cache with configurable size and TTL
- IPv4 and IPv6 validation
- Mirrors the official Python SDK behavior