PHP code example of adrianoalves / google-geolocation
1. Go to this page and download the library: Download adrianoalves/google-geolocation 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/ */
adrianoalves / google-geolocation example snippets
// a simplest example
$geoCoder = new \Geolocation\GeoCoder\GeoCoder( 'yoUr-aPiKey-hEre' );
// getting the latitude and longitude of an address
$result = $geoCoder->request( 'Praça da Sé, São Paulo, SP' );
var_dump( $result );
// same simplest example here
$distanceMatrix = new \Geolocation\DistanceMatrix\DistanceMatrix( 'yoUr-aPiKey-hEre' );
// getting the distance in metrics and the time in seconds from an address to another
$result = $distanceMatrix->request( ['Praça da Sé, São Paulo, SP'], ['Avenida Paulista, 1, São Paulo, SP'] );
var_dump( $result );
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.