Geocoder — The almost missing Geocoder PHP 5.3 library.

Uses FreeGeoIp, HostIp, IpInfoDB, Yahoo! PlaceFinder, Google Maps, Bing Maps, OpenStreetMaps, Geoip, and CloudMade geocoding services to geocode addresses and IP Addresses.


// 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
    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(''); // Orleans, France

Geocoder →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.