seymourlabs/ipapi-lookup

This package is abandoned and no longer maintained. No replacement package was suggested.

IP lookup library for the ipapi.co service

1.2 2017-08-14 12:58 UTC

This package is not auto-updated.

Last update: 2020-08-22 06:12:52 UTC


README

Perform IP lookups using the ipapi.co service

Latest Stable Version Total Downloads

Installation

This library is installed via Composer. To install, simply add it to your composer.json file:

{
    "require": {
        "seymourlabs/ipapi-lookup": "~1.0"
    }
}

And run composer to update your dependencies:

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

Basic Usage

Using the library;

require('vendor/autoload.php');

$client = new \Seymourlabs\ipapi\Client('8.8.8.8');
$response = $client->request();

$ip = $response->getIp();
$city = $response->getCity();
$region = $response->getRegion();
$country = $response->getCountry();
$postal = $response->getPostal();
$latitude = $response->getLatitude();
$longitude = $response->getLongitude();
$timezone = $response->getTimezone();
$asn = $response->getAsn();
$org = $response->getOrg();

Using a paid key with the service;

$client = new \Seymourlabs\ipapi\Client('8.8.8.8', 'myKey');