belbase / push-notification
这是 Firebase 的推送通知库。
1.0.x-dev
2018-08-24 06:30 UTC
Requires
- php: >=5.4.0
- illuminate/support: ^5.2.0
Requires (Dev)
- phpunit/phpunit: ^4.0
This package is not auto-updated.
Last update: 2024-09-29 06:25:38 UTC
README
这是 Laravel 5 的推送通知包。目前支持的服务:Firebase Cloud Messaging
安装
步骤 1: 使用 composer 安装包
composer require belbase/push-notification
步骤 2: 将服务提供者添加到 Laravel 的 config/app.php 文件中(Laravel 5.5 可选)
Belbase\PushNotification\Providers\PushNotificationServiceProvider::class,
步骤 3: 在 Laravel 的 config/app.php 文件中为 Facade 添加别名(Laravel 5.5 可选)
'PushNotification' => Belbase\PushNotification\Facades\PushNotification::class,
步骤 4: 在您的终端中运行以发布配置
php artisan vendor:publish
使用方法
编辑 config/pushnotification.php。设置适当的服务和其参数。然后在您的代码中...
use PushNotification;
使用默认服务发起请求和重定向:
/* All Required Parameters by your Service */ $deviceAccessToken = 'DEVICE-ACCESS-TOKEN-HERE'; $metaData=[ // enter data to send along with notification ]; return PushNotification::to($deviceAccessToken)->setMessage('title','body',$metaData)->sendMessage();
贡献者
许可证
PushNotification 是开源软件,许可协议为 MIT 许可。