PHP code example of jeroendesloovere / geolocation-bundle

1. Go to this page and download the library: Download jeroendesloovere/geolocation-bundle 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/ */

    

jeroendesloovere / geolocation-bundle example snippets


public function registerBundles()
{
    $bundles = array(
        // ...,
        new JeroenDesloovere\Bundle\GeolocationBundle\JeroenDesloovereGeolocationBundle()
    );
}

$geolocation = $this->get('jeroendesloovere.geolocation');

// define result
$result = $geolocation::getCoordinates('Koningin Maria Hendrikaplein', '1', 'Gent', '9000', 'belgië');

// dump result
echo 'Coordinates = ' . $result['latitude'] . ', ' . $result['longitude'] . '<br/>';

// define result: @return array(label, street, streetNumber, city, cityLocal, zip, country, countryLabel)
$result = $geolocation::getAddress(51.0363935, 3.7121008);

// define result
echo 'Address = ' . $result['label'] . '<br/>';