Uses FreeGeoIp, HostIp, IpInfoDB, Yahoo! PlaceFinder, Google Maps, Bing Maps, OpenStreetMaps, Geoip, and CloudMade geocoding services to geocode addresses and IP Addresses.
<?php
// Create an adapter
$adapter = new \Geocoder\HttpAdapter\BuzzHttpAdapter();
// Create a Geocoder object and pass it your adapter
$geocoder = new \Geocoder\Geocoder();
// Then, register all providers your want
$geocoder->registerProviders(array(
new \Geocoder\Provider\YahooProvider(
$adapter, '', $locale
),
new \Geocoder\Provider\IpInfoDbProvider(
$adapter, ''
),
new \Geocoder\Provider\HostIpProvider($adapter),
// your provider here
));
// Use it!
$result = $geocoder->geocode('Eiffel Tower'); // 48.8582, 2.2945
// Or
$result = $geocoder->geocode('88.188.221.14'); // Orleans, France
Leave a comment