Prerequisites
- PHP 8.1+ with
ip-api-io/ipapi-phpinstalled - A free ip-api.io API key
Score an IP with riskScore
Returns a score (0–100) and a human risk_level, plus the
factors that drove it. Omit the argument to score the caller's own IP.
<?php
use IpApiIo\Client;
$client = new Client(apiKey: getenv('IP_API_IO_KEY'));
$risk = $client->riskScore('185.220.101.1');
echo $risk['score']; // 88
echo $risk['risk_level']; // "high"
var_dump($risk['factors']['ip_factors']['is_tor_node']); // true
var_dump($risk['factors']['ip_factors']['is_datacenter']); // true
if ($risk['score'] >= 75) {
// block, or send to manual review / step-up auth
} Score an email with emailRiskScore
Same 0–100 scale, driven by email signals (disposable provider, invalid syntax). Use it to grade leads or gate sign-ups by address quality.
$risk = $client->emailRiskScore('user@mailinator.com');
echo $risk['score'], ' ', $risk['risk_level']; // 90 "high"
var_dump($risk['factors']['email_factors']['is_disposable']); // true Raw signals with ipReputation
Returns the underlying reputation data for an IP as an associative array — use it when you want the source signals rather than a computed score.
$reputation = $client->ipReputation('185.220.101.1');
print_r($reputation);