serhiy/pushover
Composer 安装命令:
composer require serhiy/pushover
包简介
Light, simple and fast, yet comprehensive wrapper for the Pushover API.
README 文档
README
Light, simple and fast, yet comprehensive wrapper for the Pushover API.
Features
- Message API (Example)
- Image attachment
- User's device name(s)
- Message's title
- HTML messages
- Supplementary URL and its title
- Notification priority
- Notification sound (including custom sound)
- Message time
- Time to live
- User/Group Validation API (Example)
- Validation by user or group key
- Validation by user and device
- Receipt API (Example)
- Query emergency priority receipt
- Cancel emergency priority retry
- Groups API (Example)
- Create a group
- List groups
- Retrieve information about the group
- Add / Remove users
- Enable / Disable users
- Rename the group
- Glances API (Example)
- Title
- Text
- Subtext
- Count
- Percent
- Licensing API (Example)
- Check remaining credits
- Assign license (not tested)
- Subscription API (Example)
- User Key Migration
Getting Started
These instructions will get you a copy of the project up and running.
Installing
composer require serhiy/pushover
Requirements
I aim to keep the project as simple as possible. All you need to run it is a PHP supported version,
plus its curl and json extensions. See below the require section of project's composer.json file:
{
"require": {
"php": ">=8.2",
"ext-curl": "*",
"ext-json": "*"
}
}
Pushing Messages
Instantiate pushover application and recipient of the notification:
use Serhiy\Pushover\Application; use Serhiy\Pushover\Recipient; $application = new Application('replace_with_pushover_application_api_token'); $recipient = new Recipient('replace_with_pushover_user_key');
Or use Dependency Injection to inject them into the services of your app.
Compose a message:
use Serhiy\Pushover\Api\Message\Message; $message = new Message('This is a test message', 'This is a title of the message');
Create notification:
use Serhiy\Pushover\Api\Message\Notification; $notification = new Notification($application, $recipient, $message);
Push it:
/** @var \Serhiy\Pushover\Client\Response\MessageResponse $response */ $response = $notification->push();
Tip
For more code examples, see examples folder in the root of the project.
Working with response
Client returns Response object. Checking if the message was accepted is easy:
if ($response->isSuccessful()) { // ... }
One can get status and token returned by Pushover:
$response->getRequestStatus(); $response->getRequestToken();
Or even unmodified json response from the API (json_decode into an array if needed):
$response->getCurlResponse();
Response also contains original Request object:
/** @var \Serhiy\Pushover\Client\Request\Request $request */ $request = $response->getRequest();
Request contains array for CURLOPT_POSTFIELDS curl argument and full API URL.
$request->getCurlPostFields(); $request->getApiUrl();
Tip
For complete example refer to ResponseExample.php.
Contributing
Contributions are very welcome. If you would like to add functionality, before starting your work, please open an issue to discuss the feature you would like to work on.
Please read CONTRIBUTING.md for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
There are many PHP wrappers for Pushover API. However, most of them seem abandoned, missing features or require extra libraries to work. Nevertheless, many of them inspired me to work on this project.
serhiy/pushover 适用场景与选型建议
serhiy/pushover 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 107.79k 次下载、GitHub Stars 达 22, 最近一次更新时间为 2020 年 06 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「client」 「wrapper」 「pushover」 「pushover.net」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 serhiy/pushover 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 serhiy/pushover 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 serhiy/pushover 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
A Yii2 PushOver log target and pushover messaging component
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
First-class Notifications for Craft CMS.
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
统计信息
- 总下载量: 107.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 23
- 点击次数: 21
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-04