Combustible Labs - Slack Class
Based off of the Slack Class from the laravel package: Envoy., (*1)
I've made small modifications to the Slack class to make it easier to change some of the Slack message settings., (*2)
please note: This is a very simple implementation which works, however for a more robust and better documented Slack integration I would recommend cleentfaar/slack, (*3)
Installation
to composer.json:, (*4)
require:, (*5)
#!code
"combustiblelabs/slack": "0.1.*"
repositories (though this has been placed on packagist.org so you should no longer need to add the repository):, (*6)
#!code
{"type": "git",
"url": "https://bitbucket.org/combustiblelabs/slack"}
Then run..., (*7)
composer update
Usage
$channel can either be a slack channel name ( #channel-name ) or a user ( '@'username )., (*8)
$username is the name for the Slack Bot that will show up in your slack messages window., (*9)
#!code
use Slack;
$sm = Slack::make(
['hook' => env('SLACK_INCOMING_WEBHOOK_URL'),
'message' => $message,
'channel' => $channel,
'username' => $username,
'icon_emoji' => ":bowtie:"]);
$sm->send();
If you'd like you may alias the class by placing this in app.php..., (*10)
'Slack' => CombustibleLabs\Slack\Slack::class,