PHP code example of nbolender / mapkit-web-snapshot

1. Go to this page and download the library: Download nbolender/mapkit-web-snapshot 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/ */

    

nbolender / mapkit-web-snapshot example snippets


use NBolender\MapKit\WebSnapshot;

$teamId = 'XXXXXXXXXX'; // Apple Developer Team ID
$keyId = 'XXXXXXXXXX'; // Apple MapKit Key ID
$private_key = '-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----'; // Contents of, or path to, private key file
$center = 'One Apple Park Way, Cupertino, CA 95014'; // The center of the map, specified as either coordinates or an address

// (Optional) A keyed array of any additional map parameters; JSON parameters will be automatically encoded
$additional_parameters = [
    'z' => 12,
    'size' => '300x300',
    't' => 'standard',
    'colorScheme' => 'dark',
    'annotations' => [
        [
            'color' => 'ff0000',
            'markerStyle' => 'balloon',
            'point' => 'center',
        ],
    ],
];

$url = WebSnapshot::signedURL($teamId, $keyId, $private_key, $center, $additional_parameters);
echo $url;