PHP code example of iseed838 / photon-api

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

    

iseed838 / photon-api example snippets


$client   = new \Photon\Models\PhotonClient(new \GuzzleHttp\Client());

$request  = new \Photon\Models\PhotonQueryRequest([
    'query'  => "Moscow Valilova 6",
]);
$response = $client->query($request);

$client   = new \Photon\Models\PhotonClient(new \GuzzleHttp\Client());

$request  = new \Photon\Models\PhotonReverseRequest( [
    'latitude'  => 55.630358,
    'longitude' => 37.516776,
]);
$response = $client->reverse($request);

    [0] => Photon\Models\PhotonResponse Object
        (
            [osm_id] => 537247988
            [osm_type] => W
            [extent] => Array
                (
                    [0] => 37.516021
                    [1] => 55.6309387
                    [2] => 37.5177537
                    [3] => 55.6299123
                )

            [osm_key] => building
            [osm_value] => retail
            [postcode] => 117632
            [countrycode] =>
            [country] => Russia
            [state] => Moscow
            [city] => Konkovo District
            [street] => Profsous street
            [housenumber] => 126 c3
            [latitude] => 55.63039825
            [longitude] => 37.516796697274
            [type] => Point
        )