PHP code example of teamzac / geocoder

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

    

teamzac / geocoder example snippets


GOOGLE_MAPS_API_KEY={{YOUR API KEY HERE}}

// get lat/lng from an address
Geocoder::geocode('1600 Pennsvylvania Ave, Washington DC 20500');

// get an address from lat/lng pair
Geocoder::reverseGeocode(38.8976633, -77.036573);

$result = Geocoder::geocode('123 main street anywhere USA');

$result->getState();
$result->getLocality();
$result->getStreetNumber();
.env.testing.php