tarikweiss/apple-maps-server-api-client
Composer 安装命令:
composer require tarikweiss/apple-maps-server-api-client
包简介
A PHP-based reference-implementation for the Apple Maps Server API. Uses tweaks to enhance usage with PHP.
关键字:
README 文档
README
Introduction
A PHP-based reference-implementation for the Apple Maps Server API. It uses tweaks like mapping some types as enums, to bring comfort for using this library. This library supports version 1.2+ of Apple Maps Server API.
Prerequisites
- PHP 8.1+
- OpenSSL module installed and enabled
- PSR18 + PSR17 compatible http client
Installation
composer install tarikweiss/apple-maps-server-api-client
Usage
Fast-Forward ⏩️
I have fulfilled all prerequisites, just show me the bare usage!
// This type of token source is for generated keys from the developer account. $token = new \AppleMapsServerApiClient\Auth\InterimTokenSource('eyJra...') // THis type of token source is for generating own auth token with private key. $token = new \AppleMapsServerApiClient\Auth\PrivateKeyTokenSource( 'JIHGFEDCBA', 'ABCDEFGHIJ', file_get_contents('/file/to/private/key') // Alternatively you may use an OpenSSLAsymmetricKey object for example if you use a passphrase for your key. ); $optionalPsr18ClientInstance = new \GuzzleHttp\Client(); $optionalPsr17RequestFactoryInstance = new \GuzzleHttp\Psr7\HttpFactory(); $client = new \AppleMapsServerApiClient\AppleMapsClient($token, $optionalPsr18ClientInstance, $optionalPsr17RequestFactoryInstance); $geocodeQuery = new \AppleMapsServerApiClient\Query\GeocodeQuery('Markt Leipzig'); $geocodeQuery->lang = new \AppleMapsServerApiClient\Dto\Common\Lang('de-DE'); $placeResults = $client->geocode($geocodeQuery); print_r($placeResults);
Show me everything
Key obtaining
To use this client you have to obtain either a Maps ID and a private key first.
Alternatively you may obtain a generated token, which is valid for 7 days, to experiment with the client. This should be used for development purposes only!
// Use of private key with identifier $token = new \AppleMapsServerApiClient\Auth\PrivateKeyTokenSource( 'JIHGFEDCBA', 'ABCDEFGHIJ', file_get_contents('/file/to/private/key') );
// Use of pre generated token $token = new \AppleMapsServerApiClient\Auth\InterimTokenSource('eyJra...')
Usage of the client
$optionalPsr18ClientInstance = new \GuzzleHttp\Client(); $optionalPsr17RequestFactoryInstance = new \GuzzleHttp\Psr7\HttpFactory(); $client = new \AppleMapsServerApiClient\AppleMapsClient($token, $optionalPsr18ClientInstance, $optionalPsr17RequestFactoryInstance); $geocodeQuery = new \AppleMapsServerApiClient\Query\GeocodeQuery('Markt Leipzig'); $geocodeQuery->lang = new \AppleMapsServerApiClient\Dto\Common\Lang('de-DE'); $placeResults = $client->geocode($geocodeQuery); print_r($placeResults);
HTTP Client
This library is using the php/http-discovery package to discover a default PSR18 + PSR17 compatible http client, if
no client is given. You can explicitly set the client instance, as well as the request factory instance.
For more information, please take a look into the php-http-discovery docs.
Resources
- Developer Documentation Homepage of Apple Maps Server API
- Create a Maps ID and a private key for production use
- Create a pre generated token for development purposes
- Configure http-discovery to use a specific default http client
Contribution
Please have a look into the Code of Conduct before contributing.
- For filing bugs and features please use create an issue
- For fixing bugs or adding features feel free to create a pull-request.
Docker
You may use docker to get a right-configured php instance. There is also a Makefile for some handy commands,
like updating composer dependencies, executing tests and making a static analysis.
You need docker with compose as plugin.
License
This project is licensed unter MIT license.
tarikweiss/apple-maps-server-api-client 适用场景与选型建议
tarikweiss/apple-maps-server-api-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 151 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 02 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「apple」 「api client」 「apple maps」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tarikweiss/apple-maps-server-api-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tarikweiss/apple-maps-server-api-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tarikweiss/apple-maps-server-api-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple library to decode and parse Apple Sign In client tokens.
Apple Push Notification & Feedback Provider
A PSR-7 compatible library for making CRUD API endpoints
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
Send push notification to android|ios devices , support APNs, FCM
统计信息
- 总下载量: 151
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-15