jeremygiberson / psr7-push-notification-middleware
处理推送通知的PSR7中间件
dev-master
2016-06-14 06:08 UTC
Requires
- psr/http-message: ^1.0
- symfony/event-dispatcher: ^3.1
Requires (Dev)
- phpunit/phpunit: ^5.4
This package is not auto-updated.
Last update: 2024-09-14 19:47:44 UTC
README
处理推送通知的PSR7中间件。检测推送通知并触发推送通知事件。
中间件会检查是否识别为推送通知的传入HTTP请求。如果请求被识别,则派发适当的事件。如果请求未被识别,则调用下一个中间件。
默认情况下,当处理推送通知请求时,中间件链会被终止。也就是说,即使请求指向有效的路由如 /do/something/route
或 /
,该路由功能将不会被执行。
request -> push notification middleware
if request is recognized push notification
-> dispatch notification event
-> return 200 response
else
-> return $next_middleware(request, response)
用法
理想情况下,您会向与中间件一起工厂的事件派发器添加通知事件订阅者。当推送通知到达时,这些监听器将执行一些有趣的事情。
默认设置
支持的推送通知
该库提供对一些提供推送通知的常见服务的支持。
AWS SNS 通知
http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html
Github Webhook 通知
https://developer.github.com/webhooks/#events
Gitlab Webhook 通知
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/web_hooks/web_hooks.md
Slack Webhook 通知 [待办事项]
https://api.slack.com/outgoing-webhooks
Jenkins 通知插件 [待办事项]
https://wiki.jenkins-ci.org/display/JENKINS/Notification+Plugin
通过自定义匹配器支持任何其他通知
编写一个实现 MatcherInterface 的匹配器,您就可以支持任何通知。