pigeonboys/fastpush
最新稳定版本:v0.12.0
Composer 安装命令:
composer require pigeonboys/fastpush
包简介
Fastpush is a lightweight PHP package for sending push notifications via an API, offering easy setup with channel and topic management.
README 文档
README
Introduction
Fastpush is a simple and efficient PHP package designed for sending push notifications. It allows you to easily configure and send notifications to users through channels and topics.
Installation
To install the package, run the following command:
composer require pigeonboys/fastpush
Usage
Configuration
Before calling the PushClient class for the first time, the PushConfiguration class must be initialized:
use PigeonBoys\Fastpush\Client\PushConfiguration; PushConfiguration::initialize( host: 'https://example.com/api/push', token: '<bearer-token>' );
Send Notifications
Use the PushClient::send method to send notifications to specific recipients through a defined channel and topic:
use Fastpush\Client\PushClient; use Fastpush\Entity\Channel; use Fastpush\Entity\Message; use Fastpush\Entity\Topic; $channel = new Channel( externalId: 'channel.test', name: 'Test Channel', imageUrl: 'https://example.com/images/test.png' ); $topic = new Topic( externalId: 'topic.test', name: 'Test Topic', category: 0 ); $messages = [ new Message( recipients: [100100, 100200], content: 'Hey Folks! That is a test message for 100100 and 100200.', attachments: [ 'https://cdn.example.com/100100.pdf', 'https://cdn.example.com/100200.pdf' ], ), new Message( recipients: [100300, 100400], content: 'Hey Folks! That is a test message for 100300 and 100400.', attachments: [ 'https://cdn.example.com/100300.pdf', 'https://cdn.example.com/100400.pdf' ], ) ]; $res = PushClient::send( channel: $channel, topic: $topic, messages: $messages );
统计信息
- 总下载量: 1.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-13