2017 © Pedro Peláez
 

library ipinfodb

image

pabloprieto/ipinfodb

  • Wednesday, January 28, 2015
  • by pabloprieto
  • Repository
  • 1 Watchers
  • 1 Stars
  • 35 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

IpInfoDb

ipinfodb.com PHP API Client. You have to register for an API key first., (*1)

Install

You can install the library using composer:, (*2)

"require" : {
    "pabloprieto/ipinfodb" : "v1.0"
}

Usage

Country precision (faster) :, (*3)

$ipInfo = new IpInfoDb('your_api_key');
$response = $ipInfo->country($_SERVER['REMOTE_ADDR']);

if ($response->isSuccess()) {
    echo $response->getCountryName();
} else {
    echo $response->getStatusMessage();
}

City precision :, (*4)

$ipInfo = new IpInfoDb('your_api_key');
$response = $ipInfo->city($_SERVER['REMOTE_ADDR']);

if ($response->isSuccess()) {
    echo $response->getCityName();
} else {
    echo $response->getStatusMessage();
}

HTTP Adapters

This library plays nice the most popular http clients by using egeloen/ivory-http-adapter to issue HTTP requests. You can pass any Ivory\HttpAdapter\HttpAdapterInterface instance to the constructor. The Curl adapter is used by default., (*5)

Example using Guzzle :, (*6)

use GuzzleHttp\Client;
use Ivory\HttpAdapter\GuzzleHttpHttpAdapter;

$httpAdapter = new GuzzleHttpHttpAdapter();
$ipInfo = new IpInfoDb('your_api_key', $httpAdapter);

The Versions

28/01 2015

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pablo Prieto

ipinfo ipinfodb

28/01 2015

v1.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pablo Prieto

ipinfo ipinfodb