andrewbreksa/extreme-ip-lookup

A simple HTTP wrapper for eXTReMe-IP-LOOKUP.com

1.2.1 2022-02-26 19:27 UTC

README

codecov workflow GitHub issues GitHub stars Latest Stable Version Total Downloads Latest Unstable Version License

A simple wrapper for eXTReMe-IP-LOOKUP.com

Installation

composer require andrewbreksa/extreme-ip-lookup

Usage

use AndrewBreksa\ExtremeIPLookup\Client;
use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle7\Client as GuzzleAdapter;
use Http\Message\MessageFactory\GuzzleMessageFactory;

$client = new Client(
    new GuzzleAdapter(new GuzzleClient()),
    new GuzzleMessageFactory(),
    getenv('EXT_IP_KEY')
);

$ip = '63.70.164.200';

$result = $client->lookup($ip);
echo $result->isp . PHP_EOL;

\AndrewBreksa\ExtremeIPLookup\Client::lookup returns an instance of \AndrewBreksa\ExtremeIPLookup\IPResult on success, and throws \AndrewBreksa\ExtremeIPLookup\ExtremeIPLookupException on error.