ariarijp / exception-to-slack-attachments
Format PHP Exception to Slack Attachments array for alek13/slack.
Installs: 8 783
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=5.6.0
Requires (Dev)
- alek13/slack: ^1.7
- phpunit/phpunit: 5.7.27
This package is auto-updated.
Last update: 2024-10-23 11:56:00 UTC
README
Format PHP Exception to Slack Attachments array for alek13/slack.
Requirements
PHP 5.6+ is required.
Installation
Add these lines to your composer.json
.
"require": { "ariarijp/exception-to-slack-attachments": "0.1.0" }
Usage example
<?php require_once __DIR__ . '/vendor/autoload.php'; use ExceptionToSlackAttachments\ExceptionToSlackAttachments; use Maknz\Slack; try { throw new \Exception('Something went wrong'); } catch (\Exception $e) { $attachments = ExceptionToSlackAttachments::toAttachments($e); $client = new Slack\Client('http://your.slack.endpoint'); $client->to('#general') ->attach($attachments) ->send(); }
Run above code, then you will receive message like below.
License
MIT