ariarijp/exception-to-slack-attachments

Format PHP Exception to Slack Attachments array for alek13/slack.

Maintainers

👁 ariarijp

Package info

github.com/ariarijp/exception-to-slack-attachments

pkg:composer/ariarijp/exception-to-slack-attachments

Statistics

Installs: 9 246

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2018-03-22 15:18 UTC

Requires

  • php: >=5.6.0

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 3e799f5db792a6a5632f106342884206c10a2c45

This package is auto-updated.

Last update: 2026-06-23 15:43:20 UTC


README

Format PHP Exception to Slack Attachments array for alek13/slack.

👁 Circle CI

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.

👁 example

License

MIT

Author

ariarijp