opb/laravel-hipchat
Composer 安装命令:
composer require opb/laravel-hipchat
包简介
HipChat Notifier for Laravel 4
README 文档
README
Quickly and easily send messages to Hipchat rooms, backgrounding via the Laravel queue by default. Uses v1 of the Hipchat API, with auth keys (as opposed to v2 with OAuth).
A couple of usage examples:
$user = 'Taylor'; HipchatNotifier::message("A new account [{$user}] signed up!");
Specifying some options:
$message = 'Warning, system is down!'; $options = [ 'notify' => true, 'color' => 'red', 'from' => 'System Monitor', 'room' => 'Emergency Notifications', ]; HipchatNotifier::message($message, $options);
Installation
Install into your Laravel app via composer.
"opb/laravel-hipchat": "~0.2",
and then
composer update
Register the service provider in app.php:
Opb\LaravelHipchat\HipchatNotifierServiceProvider
Note: The HipchatNotifier facade is registered automatically and does not need to be added to the aliases array in app.php.
Config - Laravel 4 (package version 0.2)
Publish the config file:
php artisan config:publish opb/laravel-hipchat
You should then find the config file at app/config/packages/opb/laravel-hipchat/config.php. Edit it to specify the required settings (API token and default room name) and additional default options.
Config - Laravel 5 (package version 0.3 and above)
Publish the config file:
php artisan vendor:publish
You should then find the config file at config/hipchat.php. Edit it to specify the required settings (API token and default room name) and additional default options. Use the env('VARIABLE_NAME') functionality where appropriate when using Laravel's .env file.
Options
There are several options which can (and some which must) be provided to the package. Most options can be specified at instantiation (via the config file) and optionally overridden when a message is sent.
| Option | Required? | Default | Override with message? | Info |
|---|---|---|---|---|
| apiToken | Yes | none | No | |
| room | Yes | none | Yes | Name of the room, not ID |
| color | No | 'yellow' | Yes | See available options below |
| from | No | 'Notification' | Yes | The message sender name |
| notify | No | false | Yes | Make Hipchat app notify |
| queue | No | true | Yes | Background to Laravel queue |
| format | No | 'auto' | Yes | Message format - html, text or auto |
- Color options - yellow, red, gray, green, purple, random
- Message format - HipChat can format basic html structures (lists, paragraphs, bold, italic, etc) when set to html format. Emoticons are only rendered when text format is used. auto will check for any html tags in your message and decide automagically which to use.
Usage
Using the HipchatNotifier facade allows you to quickly and easily send messages. The simplest is to send a message using all the default options within the package, or using those that were overridden in the config file:
HipchatNotifier::message('Test message with all default options');
You can override options on a per-message basis:
$message = 'Warning, system is down!'; $options = [ 'notify' => true, 'color' => 'red', 'from' => 'System Monitor', 'room' => 'Emergency Notifications', ]; HipchatNotifier::message($message, $options);
If you're not going to use the facade, and resolve directly out of the IOC container, the key is hipchat-notifier. For example:
$notifier = App::make('hipchat-notifier');
Todo
- Support HipChat API v2
opb/laravel-hipchat 适用场景与选型建议
opb/laravel-hipchat 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20.17k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2014 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「notification」 「laravel」 「hipchat」 「notifier」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 opb/laravel-hipchat 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 opb/laravel-hipchat 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 opb/laravel-hipchat 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP library for HipChat
This package makes it easy to send notifications via AfricasTalking with Laravel
PHP client for HipChat. Designed for incidental notifications from an application.
Beep is a lightweight Laravel package for sending notifications to your team via Slack and HipChat
HipChat module (api and logger) for Zend Framework 2
Apple Push Notification & Feedback Provider
统计信息
- 总下载量: 20.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-11-13