PHP code example of perfacilis / geocoder

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

    

perfacilis / geocoder example snippets


$api_key = '123foo456bar';

$geocoder = new Perfacilis\Geocoder\Geocoder($api_key);
$result = $geocoder->geocode('Street 12, 1234AB, Residence, Country');

$lat = $result->getLat();
$lng = $result->getLng();

$api_key = '123foo456bar';
$cacher = new GeocoderCache();

$geocoder = new Perfacilis\Geocoder\Geocoder($api_key);
$geocoder->setCacheInterface($cacher);

$result = $geocoder->query(...);


class GeocoderCache implements Psr\SimpleCache\CacheInterface
{
   ...
}