mathieuimbert / slack-logger
This is a simple package that allow a PHP script to send real time logs to Slack.
Installs: 23 738
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- guzzlehttp/guzzle: ^6.2
- psr/log: ^1.0
Requires (Dev)
- phpunit/phpunit: 5.5.*
This package is not auto-updated.
Last update: 2025-02-15 21:59:32 UTC
README
Packagist
Unit Tests
Code Quality
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
- Create an Incoming Webhook for your slack account. Make sure to read the full documentation
- Instantiate SlackLogger in your script, and start sending logs to Slack
$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:') );