Yii 1.1: egeocoder

The almost missing Geocoder PHP library as Yii component.
15 followers

The almost missing Geocoder PHP library as Yii component. This extension main goal is provide the easiest way to geocode something.

Installation and configuration

Install Geocoder via composer.

Copy component to extensions/EGeocoder directory located inside your application and add it to the application configuration the following way:

return array(
...
    'components' => array(
        ...
        'geocoder' => array(
            'class' => 'ext.EGeocoder.EGeocoder',
            // 'httpAdapter' => 'Socket',
            'providers' => array(
                new \Geocoder\Provider\FreeGeoIpProvider(new \Geocoder\HttpAdapter\CurlHttpAdapter()),
                'GeoPlugin',
                array(
                    'name' => 'IpInfoDb',
                    // Please use your own api key
                    'apiKey' => 'fe469eea906d1be01894ef2a7dd7a1d64fb9f412ab5ebdcxx2576c7af9ac04a014',
                ),
            ),
        ),
        ...
    ),
...
);

Usage example

$result = Yii::app()->geocoder->geocode('74.125.235.39');
$dumper = new \Geocoder\Dumper\GeoJsonDumper();
echo $dumper->dump($result);

Resources

Total 1 comment

#14384 report it
newscloud at 2013/08/07 12:38pm
Tutorial with eGeocoder and Zillow Neighborhood Boundary Maps for U.S.

I’ve built a free, open source demo application, MapApp, to demonstrate how to use the Zillow neighborhood boundaries and integrate them with Google Maps, geolocation and geocoding.

MapApp is built using the Yii Framework and can be run on any MySQL/PHP-capable server. MapApp also leverages Google Maps API, HTML5 Geolocation helper from estebanav, eGeocoder and egMap (the latter two are Yii extensions).

How to Use Zillow Neighborhood Maps and HTML5 Geolocation

Leave a comment

Please to leave your comment.

Create extension
Downloads