futuredialog / pushworkers
推送工作者
Requires
- guzzlehttp/guzzle: ^6.3
- maknz/slack: ^1.7
- paragraph1/php-fcm: ^0.7.0
- pda/pheanstalk: ^3.1
- sendgrid/sendgrid: ~7
- vlucas/phpdotenv: ^2.4
This package is not auto-updated.
Last update: 2024-09-25 03:45:57 UTC
README
管道
-
push_android
Android 推送通知
-
push_ios
Ios APNS 推送通知
-
push_win
Win WNS 推送通知
-
key_ios
APNS 的 Pem 密钥
推送通知
发送
$data = [
'apiKey' => '',
'recipients' => [
],
'notification' => [
'title' => '',
'body' => '',
],
'payload' => [
],
'onFail' => 'fail_tube',
'onSuccess' => 'success_tube',
'onComplete' => 'complete_tube'
];
-
apiKey
required | string or array(for WNS only)
FCM Api key 或 APNS Key name
对于 WNS,apiKey 必须是数组
$apiKey = [ 'client_id' => '', 'client_sectet' => '' ]
-
recipients
required | array
接收者数组。
设备令牌数组:例如
[ 'devide_token', 'devide_token', 'devide_token', ... ];
或者带有您可选数据的接收者数组。数据将按原样返回到回调管道中。
[ [ 'token' => 'devide_token', // Required property // Your optional data you want to receive with callback 'recipient_id' => '1', 'recipient_data' => '[], ... ], [ 'token' => 'devide_token', // Required property // Your optional data you want to receive with callback 'recipient_id' => '2', 'recipient_data' => '[], ... ], ... ];
-
notification
-
title
required | string
推送通知的标题
-
body
required | string
推送通知的主体
-
icon
optional | string | Android only
您可绘制资源名称的字符串
-
color
optional | string | in #rrggbb format | Android only
显示通知详细信息时通知图标的后台颜色
-
badge
optional | int
将通知数量添加到您的应用程序图标
-
sound
optional | string | IOS only
设置要播放的声音。
-
type
required for WNS only | string
以下之一
- raw
- badge
- tile | toast
-
-
payload
optional | array
将与推送通知一起发送的数据
-
onFail
optional | string
通知失败任务的管道。
接收者令牌数组响应示例
{ "job_id":31, "time":1498549975, "count":1, "data":[ { "token":"device_token", "status":false, "error":"NotRegistered" } ] }
接收者数组响应示例
{ "job_id":42, "time":1498550263, "count":1, "data":[ { "token":"0a39ae8b1d2c933fec9d8cb8dfb672905a275f0b7bc0ce6035829da3a72a2c03", "status":false, "error":"Error info", // your optional data goes here 'recipient_id' => '1', 'recipient_data' => '[], } ] }
-
onSuccess
optional | string
通知成功任务的管道
接收者令牌数组响应示例
{ "job_id":31, "time":1498549975, "count":1, "data":[ { "token":"device_token", "status":true } ] }
接收者数组响应示例
{ "job_id":42, "time":1498550263, "count":1, "data":[ { "token":"device_token", "status":true // your optional data goes here 'recipient_id' => '1', 'recipient_data' => '[], } ] }
-
onComplete
optional | string
通知完成任务的管道
接收者令牌数组响应示例
{ "job_id":31, "time":1498549975, "success":1, "failure":1, "data":[ { "token":"device_token", "status":true }, { "token":"device_token", "status":false, "error":"NotRegistered" } ] }
接收者数组响应示例
{ "job_id":42, "time":1498550263, "success":1, "failure":1, "data":[ { "token":"device_token", "status":true // your optional data goes here 'recipient_id' => '1', 'recipient_data' => '[], }, { "token":"device_token", "status":false, "error":"Error info" // your optional data goes here 'recipient_id' => '1', 'recipient_data' => '[], } ] }