seymourlabs / ipapi-lookup
IP lookup library for the ipapi.co service
Installs: 15 427
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- guzzlehttp/guzzle: ~6.0
This package is not auto-updated.
Last update: 2020-08-22 06:12:52 UTC
README
Perform IP lookups using the ipapi.co service
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');