There is no license information available for the latest version (0.9.0) of this package.

send messages to slack webhook

0.9.0 2016-08-05 21:45 UTC

This package is auto-updated.

Last update: 2022-09-29 01:46:36 UTC


Build Status

Monolog Handler to push log messages to a slack webhook.


Send Log Messages to Slack


//define your slack webhook Url
$slackWebhookUrl = "<token>";

// let's build our Handler
$slack = new SlackWebhookHandler(
    $slackWebhookUrl, \Monolog\Logger::DEBUG

// configure how your Slack Message should look like
$initSlackMessage = (new SlackMessage())

// ... create a SlackMessageFormater
$slack->setFormatter(new SlackMessageFormatter($initSlackMessage));

// ... finally we can build a Logger Object
$logger = new \Monolog\Logger('slack', [$slack]);

// ... and do some logging
$logger->debug("My Debug <|Link>");

$logger->info('My Info Message', [
    (new Field())->setTitle('Priority')->setValue('Small Info'),
    (new Field())->setTitle('Info')->setValue('Another small Info')

$logger->notice('My Notice Message', [
    (new SlackMessage())->setPretext('Irgendwas ist passiert')

$logger->warning("My Multiline\nWarning Message");

$logger->error('My Error Message for <!everyone>');