Use Watch-IP with PHP
digitload/watch-ip-sdk (Packagist, v0.1.1) wraps GET /v1/geo in a Composer package built on cURL — no Guzzle or other HTTP client dependency.
Install
Requires PHP 8.1+ with the curl and json extensions, both bundled with virtually every PHP install.
Composer
composer require digitload/watch-ip-sdkQuick start
As with the other server-side SDKs, calling GET /v1/geo from PHP means calling it from your own server rather than a visitor's browser, so pass an explicit origin to satisfy the key's allowed-origins check.
PHP
use Digitload\WatchIP\WatchIP;
$client = new WatchIP('wip_pub_xxxxxxxx', origin: 'https://example.com');
$geo = $client->getGeo();
echo $geo['country'], ' ', $geo['city'], ' ', $geo['timezone'];Error handling and timeouts
Every failure throws a WatchIPError extending \RuntimeException. PHP's Exception::getCode() is int-typed, but the API's error codes are strings, so read them with getErrorCode() rather than getCode(). Pass timeout (seconds) alongside include in the options array.
PHP
use Digitload\WatchIP\WatchIP;
use Digitload\WatchIP\WatchIPError;
$client = new WatchIP('wip_pub_xxxxxxxx', origin: 'https://example.com');
try {
$geo = $client->getGeo(['timeout' => 5.0]);
} catch (WatchIPError $err) {
echo $err->getErrorCode(), ' ', $err->getStatus(), ' ', $err->getMessage();
}What this SDK doesn't cover
This package only calls GET /v1/geo. IP lookup, email validation, and risk checks are separate server-to-server endpoints with no PHP client yet — call them directly with cURL, authenticated the same way the authentication guide describes.