PHP Classes

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

Recommend this page to a friend!
  Info   View files Documentation   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 154 This week: 1All time: 9,034 This week: 560Up
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: 16 packages by
Country: Russian Federation Russian Federation
Age: 33
All time rank: 78226 in Russian Federation Russian Federation
Week rank: 51 Up3 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 6x

Documentation

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 folder image Files  
File Role Description
Files folder imagelib (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  lib  
File Role Description
Files folder imageGeohelper (1 file, 3 directories)

  Files folder image Files  /  lib  /  Geohelper  
File Role Description
Files folder imageException (2 files)
Files folder imageHttp (1 file)
Files folder imageResponse (1 file)
  Plain text file ApiClient.php Class Class source

  Files folder image Files  /  lib  /  Geohelper  /  Exception  
File Role Description
  Plain text file CurlException.php Class Class source
  Plain text file InvalidJsonException.php Class Class source

  Files folder image Files  /  lib  /  Geohelper  /  Http  
File Role Description
  Plain text file Client.php Class Class source

  Files folder image Files  /  lib  /  Geohelper  /  Response  
File Role Description
  Plain text file ApiResponse.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:154
This week:1
All time:9,034
This week:560Up
User Comments (1)
bueno
4 years ago (ricardo salamanca)
70%StarStarStarStar