Created
August 22, 2024 22:02
-
-
Save drushadrusha/76282a2cf2a74738292d156c2b2e49b4 to your computer and use it in GitHub Desktop.
Create static MapKit snapshot using PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // composer require mapkit/jwt | |
| require_once('vendor/autoload.php'); | |
| use Mapkit\JWT; | |
| $privateKey = file_get_contents('private.p8'); // Private key | |
| $teamId = ''; // Team ID | |
| $keyId = ''; // Key ID | |
| $snapshotPath = "/api/v1/snapshot?center='".$lat.",".$lng."'&size=400x120&scale=2&z=9"; | |
| $signature = JWT::getToken($privateKey, $keyId, $teamId); | |
| $path = "$snapshotPath&token=$signature"; | |
| $imageurl = "https://snapshot.apple-mapkit.com".$path; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment