PHP code example of xolf / locationiq

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

    

xolf / locationiq example snippets


$search = new \Xolf\LocationIQ\Search($apiKey);
$result = $search->get("Empire State Building");

// 40.7487727
$result[0]->lat;

// -73.9849336
$result[0]->lon;

// "node"
$result[0]->osm_type;

// "Empire State Building, 362, 5th Avenue, Diamond District, Manhattan, New York County, New York City, New York, 10035, United States of America"
$result[0]->osm_type;