thisispiers/acloud
Composer 安装命令:
composer require thisispiers/acloud
包简介
Unofficial PHP client for Apple iCloud services
README 文档
README
Unofficial PHP client for Apple iCloud services.
Apple and iCloud are trademarks of Apple Inc.
| Service | Supported |
|---|---|
| Calendar | ❌ |
| Contacts | ✅ Supported |
| Drive | ❌ |
| Find My | ❌ |
| Friends | ❌ |
| ❌ | |
| Notes | ❌ |
| Photos | ❌ |
| Reminders | ❌ |
Feel free to add support for services by submitting a pull request.
Installation
composer require thisispiers/acloud
Usage
The tokens and cookies used for signing in are saved to the file path passed as the first argument to the constructor of Session. If you need to override this feature, pass in null or an empty string and use getState() and getHttpCookieJar().
If a verification code is needed for signing in, signIn() will return the string "MFA" or the obfuscated phone number the code was sent to. Retrieve the verification code from the user and pass it to verifyMFACode().
Make sure to check isSignedIn() after calling signIn() and verifyMFACode().
Here's a basic example:
<?php require __DIR__ . '/vendor/autoload.php'; $acloud = new \thisispiers\Acloud\Session(__DIR__ . '/session'); if (!$acloud->isSignedIn()) { if (empty($_POST)) { ?> <form method="POST"> <p>Username: <input type="text" name="username"></p> <p>Password: <input type="password" name="password"></p> <button type="submit">Sign in</button> </form> <?php } else if (isset($_POST['username']) && isset($_POST['password'])) { $result = $acloud->signIn($_POST['username'], $_POST['password']); if ($signIn !== true) { if ($signIn === 'MFA') { echo '<p>Verification code sent to your device(s)</p>'; } else { echo '<p>Verification code sent to ' . htmlspecialchars($signIn) . '</p>'; } ?> <form method="POST"> Verification code: <input type="text" inputmode="numeric" name="verificationCode"> <button type="submit">Sign in</button> </form> <?php } } else if (isset($_POST['verificationCode'])) { $acloud->verifyMFACode($_POST['verificationCode']); if (!$acloud->isSignedIn()) { echo '<p>Verification code invalid. Please try again.</p>'; } } } if ($acloud->isSignedIn()) { $contacts = new \thisispiers\Acloud\Contacts($acloud); $allContacts = $contacts->list(); }
API
class Session { public function __construct(?string $path = ''); public function getHttpCookieJar(): \GuzzleHttp\Cookie\CookieJarInterface; public function loadState(?string $path = ''): bool; public function saveState(): bool; public function getState(): array; public function isSignedIn(): bool; public function signIn(string $username, string $password): true|string; public function sendMFACodeSMS(): false|string; public function verifyMFACode(string $code): bool; }
Once signed in, pass the Session object into the service class constructor.
class Contacts { public function __construct(Session $session); public function list(): array; public function create(array $contacts): true; public function update(array $contacts): true; public function delete(array $contacts): true; }
Read through the source code to find out which exceptions may be thrown.
Thanks
Based on the following repositories:
thisispiers/acloud 适用场景与选型建议
thisispiers/acloud 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 479 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 03 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「client」 「sdk」 「apple」 「contacts」 「appleid」 「icloud」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 thisispiers/acloud 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thisispiers/acloud 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 thisispiers/acloud 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple library to decode and parse Apple Sign In client tokens.
Apple Push Notification & Feedback Provider
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
Send push notification to android|ios devices , support APNs, FCM
Client for Google Directions API to add interpolated points to a route consisting of given coordinates.
统计信息
- 总下载量: 479
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unlicense
- 更新时间: 2023-03-22