PHP code example of jguittard / zf-geocoder

1. Go to this page and download the library: Download jguittard/zf-geocoder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jguittard / zf-geocoder example snippets


return array(
    /* ... */
    'modules' => array(
        /* ... */
        'ZF\Geocoder',
    ),
    /* ... */
);

return [
    'geocoder' => [
        'httpAdapter' => '<SERVICE_KEY_OF_HTTP_ADAPTER>',
        'providers' => [
            'google_maps' => [
                'locale' => 'fr_FR',
                'region' => 'Île-de-France',
                'useSsl' => false,
            ],
        ],
    ],
];

public function localeAction()
{
    /* ... */
    $geocoder = $this->getServiceLocator()->get('Geocoder\GoogleMaps');
    $addressCollection = $geocoder->geocode('10 avenue Gambetta, Paris, France');
    /* ... */
}