PHP code example of madebydaniz / location-info

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

    

madebydaniz / location-info example snippets


$address = "Stephansplatz 2, 1010, Wien";
$data = LocationInfo::getInstance()::search($address);
print_r($data);

#output
Array
(
    [place_id] => 4868677
    [licence] => Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright
    [osm_type] => node
    [osm_id] => 567056993
    [boundingbox] => Array
        (
            [0] => 48.2080963
            [1] => 48.2081963
            [2] => 16.3722742
            [3] => 16.3723742
        )

    [lat] => 48.2081463
    [lon] => 16.3723242
    [display_name] => 2, Stephansplatz, Stubenviertel, KG Innere Stadt, Innere Stadt, Wien, 1010, Österreich
    [class] => place
    [type] => house
    [importance] => 0.441
)