phuocdaivl / azure-noti
使用Azure通知中心服务的推送通知
1.0.0
2019-09-24 06:39 UTC
Requires
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2024-09-25 13:33:36 UTC
README
创建注册并发送通知
下载 & 安装
composer require phuocdaivl/azure-noti
添加服务提供商
将服务提供商添加到config/app.php
配置文件中的providers数组中,如下所示
'providers' => [ ... DaiDP\AzureNoti\Providers\AzureNotiServiceProvider::class, ]
做得好。
基本使用
use \DaiDP\AzureNoti\PlatformFactory; $endpoint = PlatformFactory::getEndpoint(PlatformFactory::ENDPOINT_FCM);
方法
以下方法在PlatformEndpoint实例上可用。
createRegistration()
创建或更新注册ID
$fcmRegistration = 'fPDLWe0fKpY:APA91bHocOJCoKx5GV9ETT0bUmJDQAWiT8Ql4zFB5Ycr_sAm6tQ6aOmcTnGC3LwiyCa-beaXZoWrkxWTDvBkUVE8Th_XWNQUdzeNlbZ2MmT-lVj4Gxe4baoqVYYtmoAvZvZxghPZirOo'; $tags = ['tag1', 'tag2']; $result = $endpoint->createRegistration($fcmRegistration, $tags);
sendNativeNotification()
为账户设置新密码
$message = new \DaiDP\AzureNoti\Message([ 'title' => 'Test push notification', 'body' => 'great match!' ]); $fcmRegistration = 'fPDLWe0fKpY:APA91bHocOJCoKx5GV9ETT0bUmJDQAWiT8Ql4zFB5Ycr_sAm6tQ6aOmcTnGC3LwiyCa-beaXZoWrkxWTDvBkUVE8Th_XWNQUdzeNlbZ2MmT-lVj4Gxe4baoqVYYtmoAvZvZxghPZirOo'; $result = $endpoint->sendNativeNotification($device, $message);