PHP code example of bensquire / php-static-maps-generator
1. Go to this page and download the library: Download bensquire/php-static-maps-generator 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/ */
bensquire / php-static-maps-generator example snippets
$styling = new \GoogleStaticMap\Feature\Styling();
$styling->setHue('#006400');
$styling->setLightness(50);
$featureStyling = new \GoogleStaticMap\Feature();
$featureStyling->setFeature('all');
$featureStyling->setElement('all');
$featureStyling->setStyle($styling);
$map = new \GoogleStaticMap\Map();
$map->setCenter('London,UK');
$map->setHeight(300);
$map->setWidth(232);
$map->setZoom(8);
$map->setFormat('jpg');
$map->addFeature($featureStyling);
echo '<img src="' . $map . '" height="' . $map->getHeight() . '" width="' . $map->getWidth() . '" />';