spacedealer / geonames-api
Geonames.org api client library based on guzzle 5
0.2.2
2015-05-04 10:15 UTC
Requires
- guzzlehttp/guzzle-services: 0.5.*
Requires (Dev)
- phpunit/phpunit: 4.6.*
This package is auto-updated.
Last update: 2024-10-29 00:11:40 UTC
README
Attention: Please do not use in production environments. It‘s WIP.
This is a simple geonames API client based on Guzzle 5.
Requirements
- php >= 5.4
- guzzle 5
- guzzle services 0.5
- guzzle command 0.7
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist spacedealer/geonames-api "*"
or add
"spacedealer/geonames-api": "*"
to the require section of your composer.json
file.
Usage
$client = new \spacedealer\geonames\api\Geonames('your_username'); try { $response = $client->postalCodeSearch([ 'postalcode' => '10997', 'country' => 'de', ]); if ($response->isOk()) { $count = $response->count(); echo "Found entries: $count" . PHP_EOL; $placeName = $response->getPath('0/placeName'); echo "Place name : " . $placeName . PHP_EOL; } else { echo $response->getPath('message') . PHP_EOL; } } catch (\RuntimeException $e) { echo $e->getMessage() . PHP_EOL; }
Todos
- complete unit tests
- improve response model handling
- add support for xml only command: extendedFindNearby