appdb / php-push-sender
用于通过appdb推送服务发送推送通知的PHP库
1.0.1
2024-04-24 09:26 UTC
Requires
- guzzlehttp/guzzle: ^7.8
README
此库允许您向在appdb上发布的应用程序发送推送通知。
有关appdb推送通知服务的更多信息,请参阅文档网站
安装
composer require appdb/php-push-sender
推送通知发送(示例代码)
require_once 'vendor/autoload.php';
$sender = new \Appdb\PhpPushSender\PhpPushSender('push_xxx', 'xxx');
$payload = [
'aps' => [
'alert' => [
'title' => 'test',
'subtitle' => 'test notification',
'body' => 'test at ' . date('r')
]
]
];
$destinations['c_xxx'] = []; // sending to this customer
// OR
$destinations['c_xxx'][] = 'd_xxx'; // sending to specific device of customer
$pushSendResult = $sender->send($payload, $destinations);
var_dump($pushSendResult);