Library to report errors to slack.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
src/TailoredTunes
tests
.gitignore
.travis.yml
CONTRIBUTING.md
LICENSE
README.md
composer.json
composer.lock

README.md

php-slack-error-reporter

Report errors directly to slack for quick fixes.

We use this only on our production environments. By the time the code gets deployed, in theory, it should never throw any errors or exceptions. When it does, it's important enough that we instantly get notified.

Installation

Install via composer. Installation help and versions at Packagist

Usage

Once you create the SlackErrorReporter, it will register an error handler and an exception handler. Those will take care of everything popping up to them.


use TailoredTunes\SlackNotifier;
use TailoredTunes\SlackErrorReporter;

$slackWebhookUrl = "http://team.slack.com/whatever";

$slack = new SlackNotifier($slackWebhookUrl);
$usernameForMessage = $_ENV['WEB_NODE_NAME'];
new SlackErrorReporter($slack, $usernameForMessage, '#errors', '#exceptions');