Skip to content

PHP SDK

Packagist GitHub

Official PHP client. One call returns the full payload: geolocation, timezone, flag, currency, connection (ASN/ISP), security, and user-agent when present.

Terminal window
composer require ipwho/ipwho-ip-geolocation-api

PHP >= 7.4, ext-json, Guzzle ^7. Namespace: IpWho\SDK\Client.

<?php
require 'vendor/autoload.php';
use IpWho\SDK\Client;
$client = new Client(getenv('IPWHO_API_KEY'));
$res = $client->lookup('8.8.8.8'); // GET /ip/{ip}
$me = $client->me(); // GET /me
$bulk = $client->bulk(['8.8.8.8', '1.1.1.1']); // GET /bulk/{a,b,c}
echo $res->data->geoLocation->country; // United States
v1v2
getIp / getLocation($ip)lookup($ip) then $res->data->geoLocation
getMe / getLocation()me()
(missing)bulk($ips)
  • lookup($ip)GET /ip/{ip}
  • me()GET /me
  • bulk($ips)GET /bulk/{a,b,c}; rows on data->responseArray