PHP code example of powderblue / geocoding-api

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

    

powderblue / geocoding-api example snippets


Array
(
    [address] => Array
        (
            [streetAddress] => 25 Old Gardens Close
            [addressLocality] => Tunbridge Wells
            [addressRegion] => Kent
            [postalCode] => TN2 5ND
            [addressCountry] => GB
        )

    [latitude] => 51.1172303
    [longitude] => 0.2635245
)

$geocode = new Geocode('<your-api-key>');

// Without using region biasing
$geoCoordinates = $geocode->byAddress('25 Old Gardens Close Tunbridge Wells TN2 5ND');

// `byAddress()` accepts an *ISO 3166-1 alpha-2 code* to apply bias by a specific country
$geoCoordinates = $geocode->byAddress('25 Old Gardens Close Tunbridge Wells TN2 5ND', 'GB');

$geocode = new Geocode('<your-api-key>');

// `byPostcode()` *> Palma, Majorca

$geocode = new Geocode('<your-api-key>');
$geoCoordinates = $geocode->byLatLong('50.88916732998306', '-0.5768395884825535');
  // => Arundel, West Sussex, GB