jdlxnl/slack

Wrapper around slack library to make notification easier

1.0.2 2021-12-23 10:33 UTC

This package is auto-updated.

Last update: 2024-05-23 15:42:28 UTC


README

Ads some decoration and utility functions around Laravels slack notification channel. Mainly focussed around Personas as sender, and functionality to build custom payloads.

Installation

composer require jdlxnl/slack

Usage

    use Jdlx\Slack\Notifications\SlackNotification;
    use Jdlx\Slack\Sender;
    use Jdlx\Slack\Slack;
    use Jdlx\Task\Slack\Attachment\TaskFailure;

    $builder = (new TaskFailure())->withJob($job)->withTaskLog($log);

    Slack::channel()->notify(
            new SlackNotification(
                $title,
                Sender::persona(Sender::TASK_RUNNER),
                $builder->toSlackAttachment()
            ));