evodelavega/pushover-net
Composer 安装命令:
composer require evodelavega/pushover-net
包简介
A simple wrapper for the Pushover.net API
README 文档
README
Simple, standalone, clean PHP wrapper for the pushover.net API
A basic example (push a message):
Pushing a message is quite simple. But unlike other wrappers I've seen, it is equally easy to validate users and groups, Check receipts for pushed message, choose the sounds (through constants) etc...
Here's a simple example:
<?php $credentials = new Credentials( 'APP token', 'user API' ); //API settings array $apiSettings = [ 'baseUrl' => 'the url',//default works fine 'output' => Api::OUTPUT_JSON ]; //create message object $message = new Message( [ 'message' => 'The message', 'title' => 'The title', 'priority' => Message::PRIORITY_EMERGENCY, 'sound' => Message::SOUND_GAME ], $credentials ); //USING THE WRAPPER: //get API section: $api = Api::GetApiSection( Api::SECTION_PUSH,//get push section, $apiSettings ); //push message $response = $api->pushMessage($message); //check receipt, alternative way of creating API wrapper: $api = new Receipt($apiSettings); //get the receipt for the response $receipt = $api->getReceipt( $response, $credentials );
Bascially, this example serves to show that, after constructing the Credentials class, the use of the API is pretty
straightforward. After all things have been set up, it's a simple matter of passing through objects.
If anything goes wrong, an appropriate exception will be thrown.
What can this wrapper do?
Good question. Put simply this is a minimalistic setup which allows you to:
- Push messages (examples/example.php shows you how)
- Validate users, groups and their devices
- Process receipts, if you want to
- Easily extend the functionality (look at the base classes
PushOver\ApiandPushOver\Model\Data)
What can't it do (yet)?
Another good question. Things that are missing from this wrapper (but will be added shortly) are:
- Support for XML formatted responses (will not be added any time soon)
- Unit tests (Are being added now)
- Improve data-model consistency, and make the overall API more consistent
What might be added in the future?
- Better error/exception handling
- Consistency tweaks (return values/property types)
- Data models should implement the
\Traversableinterface somehow - ...
I'm open to suggestions, so if there's something you're looking for and, like me, found the existing wrappers lacking: create an issue, and I'll be happy to look into it
Getting the example.php script to work
It's as simple as creating the params.json file in the examples directory. The JSON should look something like:
{
"credentials": {
"user": "<your user string>",
"token": "<the API token>"
},
"api": {
"baseUrl": "base url like: https://api.pushover.net/1/",
"output": ".json (or, when added .xml, xml is currently unsupported)"
}
}
If you're trying to use the Api::GetApiSection method to load an API class other than PushOver\Push, don't forget to require it (or better yet, register the autoloader composer will helpfully give you)
That's it!
==========
Contributing is optional, but encouraged.
If you see room for improvement, or want to make a suggestion: don't hold back, create issues. Fork, create pull requests... the works. Collaborating is fun.
evodelavega/pushover-net 适用场景与选型建议
evodelavega/pushover-net 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.07k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2014 年 10 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「json」 「client」 「notifications」 「wrapper」 「notification」 「push」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 evodelavega/pushover-net 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 evodelavega/pushover-net 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 evodelavega/pushover-net 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova package that adds a notification feed in your Nova app.
Kinikit - PHP Application development framework MVC component
ext-json wrapper with sane defaults
A package to cast json fields, each sub-keys is castable
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
统计信息
- 总下载量: 11.07k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-10-24