PHP code example of geertboetzkes / heremaps

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

    

geertboetzkes / heremaps example snippets



$geoCoder = new GeoCoder(API_KEY, API_SECRET);

$results = $geoCoder->locate("addressstring 1a city")->search();

print_R($results);


$route = new Route(API_KEY, API_SECRET);

$waypoints["a"] = new RouteWaypoint(51.97109267, 5.26213026);
$waypoints["b"] = new RouteWaypoint(52.11244458, 5.36696158);

$result = $route
    ->AddWaypoint($waypoints['a'])
    ->AddWaypoint($waypoints["b"])
    ->vehicle(RouteVehicles::Truck)
    ->trafficInfo(true)
    ->mode(RouteTypes::Fastest)
    ->get();


print_R($result);`



 $map  = new Mapview(API_KEY, API_SECRET);

$result = $map
    ->coordinates(51.97109267, 5.26213026)
    ->pointsOfInterest(
        [
            52.05811712, 5.47741202,
            52.11244458, 5.36696158,
            51.97504327, 5.24482833
        ]
    )
    ->uncertainty(1000)
    ->type(2)
    ->get();

echo "<img src='data:image/png;base64, ".base64_encode($result)."'>";