PHP code example of marcoboom / google-maps-geocode-api

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

    

marcoboom / google-maps-geocode-api example snippets


	
	$geo = new GoogleMapsGeocodeApi\Geocode("Kalverstraat 100 Amsterdam");
	
	echo "Street: ".$geo->street().PHP_EOL;
	echo "Housenumber: ".$geo->housenumber().PHP_EOL;
	echo "Postcode: ".$geo->postcode().PHP_EOL;
	echo "City: ".$geo->city().PHP_EOL;
	echo "Town: ".$geo->town().PHP_EOL;
	echo "Province: ".$geo->state().PHP_EOL;
	echo "Country: ".$geo->country().PHP_EOL;
	echo "Country code: ".$geo->country_code().PHP_EOL;
	echo "Latitude: ".$geo->lat().PHP_EOL;
	echo "Longitude: ".$geo->lon().PHP_EOL;
	echo "Formatted address: ".$geo->formatted().PHP_EOL;