PHP code example of ariarijp / exception-to-slack-attachments
1. Go to this page and download the library: Download ariarijp/exception-to-slack-attachments library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ariarijp / exception-to-slack-attachments example snippets
xceptionToSlackAttachments\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();
}