PHP GeoHelper API Client: Retrieve location lists using the Geohelper API

Recommend this page to a friend!
  Info   Documentation   View files (8)   Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 152 All time: 8,811 This week: 357
Version License PHP version Categories
geohelper-api-client 1.0.0BSD License5PHP 5, Web services, Geography
Description Author

This package can retrieve location lists using the Geohelper API.

It can send HTTP requests to the Geohelper API to retrieve several types of lists related with geographic locations like for countries list, country cities list, country regions lists and city streets list.

The class can also retrieve other locale dependent information related with phones, service locality and post codes.

Innovation Award
PHP Programming Innovation award nominee
May 2019
Number 9
Knowing details about the location in the world where each user is, it is a very important for many types of applications.

This package not only is able to determine the location of a user based on the IP address of his computer, but also other details like countries lists, country city lists and region lists where the users may be located.

Manuel Lemos
Picture of Dmitry Mamontov
  Performance   Level  
Name: Dmitry Mamontov <contact>
Classes: 15 packages by
Country: Russian Federation Russian Federation
Age: 29
All time rank: 88632 in Russian Federation Russian Federation
Week rank: 61 6 in Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 6x

Details

Geohelper API PHP client

PHP-client for Geohelper API.

Use API documentation

Requirements

  • PHP 5.3 and above
  • PHP's cURL support

Install

1) Get composer

2) Run into your project directory:

composer require dmamontov/geohelper-api-client-php ~1.0.0

If you have not used composer before, include autoloader into your project.

require 'path/to/vendor/autoload.php';

Usage

Get countries

$client = new \Geohelper\ApiClient(
    'api_key'
);


try {
    $response = $client->countriesList();
} catch (\Geohelper\Exception\CurlException $e) {
    echo "Connection error: " . $e->getMessage();
}

if ($response->isSuccessful()) {
    $countries = isset($response['result']) ? $response['result'] : array();
    foreach ($countries as $country) {
        echo $country['name'];
    }
} else {
    echo sprintf(
        "Error: [HTTP-code %s] %s",
        $response->getStatusCode(),
        $response->getErrorMsg()
    );
}
  Files  
File Role Description
lib (1 directory)
composer.json Data Auxiliary data
LICENSE Lic. License text
README.md Doc. Documentation

  Files  /  lib  
File Role Description
Geohelper (1 file, 3 directories)

  Files  /  lib  /  Geohelper  
File Role Description
Exception (2 files)
Http (1 file)
Response (1 file)
   ApiClient.php Class Class source

  Files  /  lib  /  Geohelper  /  Exception  
File Role Description
   CurlException.php Class Class source
   InvalidJsonException.php Class Class source

  Files  /  lib  /  Geohelper  /  Http  
File Role Description
   Client.php Class Class source

  Files  /  lib  /  Geohelper  /  Response  
File Role Description
   ApiResponse.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:152
This week:0
All time:8,811
This week:357
User Comments (1)
bueno
1 year ago (ricardo salamanca)
70%
 

For more information send a message to info at phpclasses dot org.