protonlabs / apns-php
Apple Push 通知 & 反馈提供者
2.2.3
2022-04-27 10:21 UTC
Requires
- php: >=7.4
- ext-curl: *
- lib-openssl: *
- lcobucci/jwt: ^4.1.0
- psr/log: ^1 || ^2 || ^3
Requires (Dev)
- phpstan/phpstan: ^1.6
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-08 08:54:41 UTC
README
A full set of open source PHP classes to interact with the Apple Push Notification service for the iPhone, iPad and the iPod Touch.
Based on https://github.com/M2mobi/ApnsPHP and https://github.com/immobiliare/ApnsPHP
Packagist
https://packagist.org.cn/packages/protonlabs/apns-php
composer req protonlabs/apns-php
架构
- 消息类,用于构建通知有效载荷。
- 推送类,用于将一条或多条消息推送到苹果推送通知服务。
- 反馈类,用于查询苹果反馈服务以获取损坏的设备令牌列表。
- 推送服务器类,用于创建一个包含一个或多个(分支)进程的推送服务器,这些进程从公共消息队列中读取。
- 日志类/接口,用于记录到标准输出或用于自定义日志记录目的(支持实现 PSR-3 日志器接口的日志器)。
详细信息
在苹果推送通知二进制协议中,没有关于推送通知到服务器的正确性的实时反馈。因此,在每次写入服务器后,推送类会等待“读取流”状态改变(至少 N 微秒);如果发生这种情况,并且客户端套接字从服务器接收“文件结束”信号,则推送到服务器的通知已损坏,苹果服务器已关闭连接,客户端需要重新连接以发送消息队列中尚存的其它通知。
为了加快发送活动,可以使用推送服务器类创建一个包含多个进程的推送通知服务器,这些进程读取公共消息队列并并行发送推送通知。
所有客户端-服务器活动都基于“出错时重试”模式,具有可自定义的超时时间、重试次数和重试间隔。
要求
PHP 7.4.0 或更高版本,需要 OpenSSL、PCNTL、System V 共享内存和信号量支持。