seleznev/beep
Composer 安装命令:
composer require seleznev/beep
包简介
Beep is a lightweight Laravel package for sending notifications to your team via Slack and HipChat
README 文档
README
Beep is a lightweight Laravel package for sending notifications to your team via Slack and HipChat. Inspiration and the initial code was taken from Laravel Envoy.
Installation
Require the seleznev/beep package using Composer:
composer require seleznev/beep
Add the service provider in config/app.php to providers array:
Seleznev\Beep\ServiceProvider::class,
Add the alias in config/app.php to aliases array:
'Beep' => Seleznev\Beep\Facade::class,
For the Laravel 5.0.* you should add 'Seleznev\Beep\ServiceProvider', and 'Beep' => 'Seleznev\Beep\Facade', respectively.
Configuration
To get started, you'll need to create a Slack token or a HipChat token.
Add your SLACK_TOKEN and HIPCHAT_TOKEN to the .env file.
Usage
Send a message to a Slack channel:
Beep::slack('#channel')->say('Hi');
Send a message to a HipChat room:
Beep::hipchat('room')->say('Hi');
Send a message from a chosen name:
Beep::slack('#channel')->from('My application')->say('Hi');
A few attractive examples:
public function report(Exception $e) { parent::report($e); $message = App::environment().': '.$e->getMessage(); Beep::slack('#logs')->say($message); }
Post::created(function ($post) { $message = "*{$post->user->name}* has created _{$post->title}_ post!"; Beep::slack('#activity')->say($message); }); Post::created(function ($post) { $message = "<b>{$post->user->name}</b> has created <i>{$post->title}</i> post!"; Beep::hipchat('activity')->say($message); });
Lumen
Add the service provider in bootstrap/app.php to Register Service Providers block:
$app->register(Seleznev\Beep\ServiceProvider::class);
app('beep')->slack('#channel')->say('Lumen');
License
Beep is licensed under The MIT License (MIT).
统计信息
- 总下载量: 9.51k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-31