Tiger_Location_Adapter_IpApi
@api· extendsTiger_Location_Adapter_Abstract
Tiger_Location_Adapter_IpApi — approximate location for an IP address (CAP_IP only).
Backed by ip-api.com, which is free for non-commercial / development use (no key, but rate-limited and http-only on the free tier). It is deliberately the dev default so a fresh install has working IP geolocation with zero setup — but it should NOT be pointed at in production. For production, swap in a paid vendor (the endpoint + field mapping are the only things that change): ipinfo.io, ipgeolocation.io, ipstack, or ip2location are all drop-in alternatives, and none carry MaxMind's licensing baggage. (AskLevi runs a paid, non-MaxMind vendor in prod for exactly this reason.) Because the whole thing is just an endpoint + a small field map, retargeting it is a config change, not a rewrite.
Config (tiger.location.adapters.ipapi.*):
- endpoint : base URL (default 'http://ip-api.com/json')
- key : optional API key (appended as &key=… for paid/keyed endpoints)
Every failure degrades to null so the caller can carry on without location.
Methods
capabilities()
capabilities(): array
The CAP_* operations this adapter supports (IP geolocation only).
Returns array — a list of CAP_* capability constants
ip()
ip(string $ip, array $opts = []): ?Tiger_Location_Place
Resolve an IP to an approximate Tiger_Location_Place, or null when the provider can't place it (private/invalid IP, rate-limit, network error, …).
$ipstring— the IP address to look up$optsarray— provider options
Returns ?Tiger_Location_Place — the place, or null when unplaceable