mathieuimbert/slack-logger

This is a simple package that allow a PHP script to send real time logs to Slack.

0.3.0 2017-03-06 18:08 UTC

This package is not auto-updated.

Last update: 2024-04-13 17:41:01 UTC


README

Packagist

Latest Stable Version Latest Unstable Version Total Downloads License

Unit Tests

Build Status Coverage Status

Code Quality

SensioLabsInsight

Description

This is a simple package that allow a PHP script to send real time logs to Slack.

Please be aware that the repository is still in an early phase, and every new commit might not be backward compatible.

Installation

Installation of Slack Logger is done using Composer.

composer require mathieuimbert/slack-logger

Usage

$logger = new \MathieuImbert\Slack\Logger\SlackLogger('https://hooks.slack.com/services/xxxxxxx/xxxxxxx/xxxxxxx');
$logger->warning('This a not test of the emergency broadcast system, this is the real thing');

Options

You can customize the name and the icon of your logger in the incoming webhook configuration, or you can do it from SlackLogger by passing the right options to he constructor:

$logger = new \MathieuImbert\SlackLogger\SlackLogger(
    'https://hooks.slack.com/services/xxxxxxx/xxxxxxx/xxxxxxx',
    array('username' => 'My Slack Logger', 'icon_emoji' => ':cop:')
);