nbolender / mapkit-web-snapshot
生成指向Apple MapKit Web快照的签名URL。
v1.0.0
2021-02-03 07:03 UTC
Requires
- php: >=7.0.0
- ext-openssl: *
This package is auto-updated.
Last update: 2024-09-14 11:33:53 UTC
README
PHP库,用于生成指向Apple Maps Web快照的签名URL。
安装
composer require nbolender/mapkit-web-snapshot
使用方法
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;
Apple文档
许可协议
本项目是开源软件,遵循MIT许可协议。
致谢
本项目由Nathan Bolender开发。特别感谢Thomas Schoffelen及其MapKit JWT库,本项目参考了该库。