PHP code example of miclf / static-map

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

    

miclf / static-map example snippets




use Miclf\StaticMap\StaticMap;

// This generates a map centred on the Atomium, in Brussels.
StaticMap::centeredOn(50.89492, 4.34152)->save('path/to/map.png');

// Specify the zoom level as a third argument to the constructor.
StaticMap::centeredOn(50.89492, 4.34152, 10)->save('path/to/map.png');

// Alternatively, you can also specify a zoom level with a dedicated method.
StaticMap::centeredOn(50.89492, 4.34152)
    ->withZoom(10)
    ->save('path/to/map.png');

// Generates a map with a width of 500px and a height of 250px.
StaticMap::centeredOn(50.89492, 4.34152)
    ->withDimensions(500, 250)
    ->save('path/to/map.png');

StaticMap::centeredOn(50.89492, 4.34152)
    ->withTileProvider('https://tile.openstreetmap.be/osmbe/{z}/{x}/{y}.png')
    ->save('path/to/map.png');

StaticMap::centeredOn(50.89492, 4.34152)
    ->debug()
    ->save('path/to/map.png');