alchemy / geonames-api-consumer
A connector to a geonames server
Installs: 115 033
Dependents: 1
Suggesters: 0
Security: 0
Stars: 6
Watchers: 13
Forks: 4
Open Issues: 2
Requires
- php: ~7.0
- guzzle/guzzle: ~3.5
- silex/silex: ~2.0
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2024-11-08 17:56:18 UTC
README
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.