2017 © Pedro Peláez
 

library ipstack-client

A PHP wrapper for using Ipstack API

image

ok/ipstack-client

A PHP wrapper for using Ipstack API

  • Thursday, July 5, 2018
  • by GitHubHubus
  • Repository
  • 1 Watchers
  • 1 Stars
  • 110 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Latest Stable Version Total Downloads License, (*1)

ipstack-client

A PHP wrapper for using Ipstack API, (*2)

Install via composer:

composer require ok/ipstack-client

Basic usage

Get data as the Location object:, (*3)

$client = new OK\Ipstack\Client('api_key');
$location = $client->get('134.201.250.155', false);
var_dump($location);

result:, (*4)

class OK\Ipstack\Entity\Location#3 (12) {
  protected $city =>
  string(11) "Los Angeles"
  protected $continentCode =>
  string(2) "NA"
  protected $continentName =>
  string(13) "North America"
  protected $countryCode =>
  string(2) "US"
  protected $countryName =>
  string(13) "United States"
  protected $regionCode =>
  string(2) "CA"
  protected $regionName =>
  string(10) "California"
  protected $zip =>
  string(5) "90026"
  protected $latitude =>
  double(34.0766)
  protected $longitude =>
  double(-118.2646)
  protected $ip =>
  string(15) "134.201.250.155"
  protected $valid =>
  bool(true)
}

Get data as a simple array:, (*5)

$client = new OK\Ipstack\Client('api_key');
$location = $client->get('134.201.250.155');
var_dump($location);

result:, (*6)

array(13) {
  'ip' =>
  string(15) "134.201.250.155"
  'type' =>
  string(4) "ipv4"
  'continent_code' =>
  string(2) "NA"
  'continent_name' =>
  string(13) "North America"
  'country_code' =>
  string(2) "US"
  'country_name' =>
  string(13) "United States"
  'region_code' =>
  string(2) "CA"
  'region_name' =>
  string(10) "California"
  'city' =>
  string(11) "Los Angeles"
  'zip' =>
  string(5) "90026"
  'latitude' =>
  string(7) "34.0766"
  'longitude' =>
  string(9) "-118.2646"
  'location' =>
  array(8) {
    'geoname_id' =>
    string(7) "5368361"
    'capital' =>
    string(15) "Washington D.C."
    'languages' =>
    array(3) {
      'code' =>
      string(2) "en"
      'name' =>
      string(7) "English"
      'native' =>
      string(7) "English"
    }
    'country_flag' =>
    string(38) "http://assets.ipstack.com/flags/us.svg"
    'country_flag_emoji' =>
    string(8) "🇺🇸"
    'country_flag_emoji_unicode' =>
    string(15) "U+1F1FA U+1F1F8"
    'calling_code' =>
    string(1) "1"
    'is_eu' =>
    array(0) {
    }
  }
}

Information

Modifiable output params

Available params for getting custom result, (*7)

For example:, (*8)

$client = new OK\Ipstack\Client('api_key');
$client->getParams()->addField("calling_code");

Data providers

Now, here are available several providers: * TYPE_IPSTACK * TYPE_IPAPI, (*9)

You can change provider by pass one of type above as second argument in constructor, (*10)

For example:, (*11)

$client = new OK\Ipstack\Client('api_key', OK\Ipstack\Provider\ProviderFactory::TYPE_IPAPI);

The Versions

05/07 2018

dev-master

9999999-dev https://github.com/GitHubHubus/ipstack-client

A PHP wrapper for using Ipstack API

  Sources   Download

The Requires

  • php >=7.0

 

The Development Requires

by Oleg Kochetkov

api php ip client geocode ipstack

05/07 2018

1.2

1.2.0.0 https://github.com/GitHubHubus/ipstack-client

A PHP wrapper for using Ipstack API

  Sources   Download

The Requires

  • php >=7.0

 

The Development Requires

by Oleg Kochetkov

api php ip client geocode ipstack

04/07 2018

1.1

1.1.0.0 https://github.com/GitHubHubus/ipstack-client

A PHP wrapper for using Ipstack API

  Sources   Download

The Requires

  • php >=7.0

 

The Development Requires

by Oleg Kochetkov

api php ip client geocode ipstack

29/06 2018

1.0

1.0.0.0 https://github.com/GitHubHubus/ipstack-client

A PHP wrapper for using Ipstack API

  Sources   Download

The Requires

  • php >=7.0

 

The Development Requires

by Oleg Kochetkov

api php ip client geocode ipstack