vyconsulting-group/push-notification
Composer 安装命令:
composer require vyconsulting-group/push-notification
包简介
PHP wrapper FCM
README 文档
README
wetillix/push-notification is a simple and efficient PHP package for sending notifications via Firebase Cloud Messaging (FCM).
Installation
Install the package via Composer:
composer require wetillix/push-notification
Configuration
After installation, prepare your firebase_credentials.json file containing your FCM credentials. Store this file securely in your project.
Usage
Initialization
Import and initialize the service in your project, providing the path to the FCM credentials file in the constructor:
use Wetillix\PushNotification\PushNotification; $pushNotification = new PushNotification('/path/to/firebase_credentials.json');
Sending a Notification to a Specific Device
Use the sendPushNotificationToDevice method to send a notification to a user:
$response = $pushNotification->sendPushNotificationToDevice( token: 'device_token', data: [ 'title' => 'value1', 'description' => 'value2' ] );
Sending a Notification to a Topic
Use the sendPushNotificationToTopic method to send a notification to all users subscribed to a topic:
$response = $pushNotification->sendPushNotificationToTopic( topic: 'topic_name', data: [ 'title' => 'value1', 'description' => 'value2' ] );
Contribution
Contributions are welcome! Follow these steps:
- Fork the project.
- Create a new branch:
git checkout -b my-branch. - Make your changes.
- Submit a Pull Request.
License
This project is licensed under the MIT license.
统计信息
- 总下载量: 4.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 15
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2019-03-28