seleznev / beep
Beep is a lightweight Laravel package for sending notifications to your team via Slack and HipChat
Installs: 9 512
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.5.9
- illuminate/support: ~5.0
- nategood/httpful: ~0.2
This package is not auto-updated.
Last update: 2024-12-21 20:35:59 UTC
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).