PHP code example of davidvandertuijn / geocode

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

    

davidvandertuijn / geocode example snippets


use Davidvandertuijn\Geocode;

$geocode = new Geocode();

$geocode->setApiKey(''); // Your application's API key.
$geocode->setAddress('Westblaak 180, 3012 KN, Rotterdam, NL');

if ($geocode->request()) {
    $latitude = $geocode->getLatitude(); // 51.9163212
    $longitude = $geocode->getLongitude(); // 4.475754
}