alchemy/geonames-api-consumer

A connector to a geonames server

Installs: 117 968

Dependents: 1

Suggesters: 0

Security: 0

Stars: 7

Watchers: 12

Forks: 5

Open Issues: 2

pkg:composer/alchemy/geonames-api-consumer

4.1.0 2018-04-12 18:21 UTC

This package is auto-updated.

Last update: 2025-10-08 20:11:55 UTC


README

Build Status

This is a consumer for the GeonamesServer.

Usage

  • Connector creation :
$connector = ALchemy\Geonames\Connector::create($serverUrl);
  • Query cities :
// returns an array of Alchemy\Geonames\Geoname objects
$geonames = $connector->search('Paris');

Query options :

// limit to 50 results
// use '89.73.4.152' as IP address for closeness sort
$connector->search('Paris', 50, '89.73.4.152');
  • Find by IP :
// returns a Alchemy\Geonames\Geoname object
$geoname = $connector->ip('89.73.4.152');
  • Find a GeonameId :
// returns a Alchemy\Geonames\Geoname object
$geoname = $connector->geoname(2988507);

Silex Service Provider

$app = new Silex\Application();
$app->register(new Alchemy\Geonames\GeonamesServiceProvider(), array(
    'geonames.server-uri' => 'http://geonames.domain.tld',  // mandatory parameter
));

License

This project is released under the MIT License.