PHP SDK
Official PHP client. One call returns the full payload: geolocation, timezone, flag, currency, connection (ASN/ISP), security, and user-agent when present.
- Source: lavrox/SDK-IPWho-IP-Geolocation-PHP
- Packagist:
ipwho/ipwho-ip-geolocation-apiv2.0.0 - API key: ipwho.org/free-plan
Installation
Section titled “Installation”composer require ipwho/ipwho-ip-geolocation-apiPHP >= 7.4, ext-json, Guzzle ^7. Namespace: IpWho\SDK\Client.
Quick start
Section titled “Quick start”<?phprequire '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 StatesMigrating from v1
Section titled “Migrating from v1”| v1 | v2 |
|---|---|
getIp / getLocation($ip) | lookup($ip) then $res->data->geoLocation |
getMe / getLocation() | me() |
| (missing) | bulk($ips) |
Methods
Section titled “Methods”lookup($ip)—GET /ip/{ip}me()—GET /mebulk($ips)—GET /bulk/{a,b,c}; rows ondata->responseArray