PHPackages                             dealerinspire/slack-notifications - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. dealerinspire/slack-notifications

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

dealerinspire/slack-notifications
=================================

This package provides a way to easily send Slack notifications with attachments.

1.1.2(4y ago)01.0k1MITPHPPHP ^7.2.0 || ^8.0CI failing

Since Mar 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/dealerinspire/slack-notifications)[ Packagist](https://packagist.org/packages/dealerinspire/slack-notifications)[ RSS](/packages/dealerinspire-slack-notifications/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (2)Versions (8)Used By (0)

Slack Notifications
===================

[](#slack-notifications)

[![PHP Composer](https://github.com/dealerinspire/slack-notifications/actions/workflows/php.yml/badge.svg)](https://github.com/dealerinspire/slack-notifications/actions/workflows/php.yml)

An easy, fluent implementation of a Slack notification system.

Adding the Package to Your Project
----------------------------------

[](#adding-the-package-to-your-project)

### Requiring in Composer

[](#requiring-in-composer)

```
composer require dealerinspire/slack-notifications

```

### Adding to Your Code

[](#adding-to-your-code)

At the top of the class file where you wish to use:

```
use DealerInspire\SlackNotifications\SlackNotification;

```

Basic Implementation
--------------------

[](#basic-implementation)

```
$slackNotification = (new SlackNotification)
    ->toHook('abc\123\xyz')
    ->withUsername('Newt Scamander')
    ->withIcon('unicorn_face')
    ->toChannel('#mythical_beasts')
    ->withTitle('Testing Slack Notification')
    ->withText('Just checking to make sure the notification goes through')
    ->unfurlLinks(false)
    ->unfurlMedia(false)
    ->send();

```

With Simple Attachment
----------------------

[](#with-simple-attachment)

At the top of the class file where you wish to use:

```
use DealerInspire\SlackNotifications\SlackNotification;
use DealerInspire\SlackNotifications\SlackAttachment;

```

In your class code:

```
$slackAttachment = (new SlackAttachment)
    ->createFromArray([
        'fallback' => 'The Mythical Animal is a Unicorn',
        'title' => 'What are Mythical Animals?',
        'text' => 'Mythical animals are creatures that dont exist',
    ]);

$slackNotification = (new SlackNotification)
    ->toHook('abc\123\xyz')
    ->withUsername('Newt Scamander')
    ->withIcon('unicorn_face')
    ->toChannel('#mythical_beasts')
    ->withTitle('Testing Slack Notification')
    ->withText('Just checking to make sure the notification goes through')
    ->unfurlLinks(false)
    ->unfurlMedia(false);
    ->withAttachments([$slackAttachment])
    ->send();

```

With More Complex Attachment
----------------------------

[](#with-more-complex-attachment)

At the top of the class file where you wish to use:

```
use DealerInspire\SlackNotifications\SlackNotification;
use DealerInspire\SlackNotifications\SlackAttachment;
use DealerInspire\SlackNotifications\SlackAttachment\SlackAttachmentAction;
use DealerInspire\SlackNotifications\SlackAttachment\SlackAttachmentField;

```

In your class code:

```
$unicornAttachmentField = (new SlackAttachmentField)
    ->createFromArray([
        'title' => 'Mythical Animal',
        'value' => 'Unicorn',
        'short' => true,
    ]);

$unicornAttachmentAction = (new SlackAttachmentAction)
    ->createFromArray([
        'text' => 'Find more about Unicorns',
        'url' => 'https://en.wikipedia.org/wiki/Unicorn',
    ]);

$slackAttachment = (new SlackAttachment)
    ->createFromArray([
        'fallback' => 'The Mythical Animal is a Unicorn',
        'title' => 'What are Mythical Animals?',
        'text' => 'Mythical animals are creatures that dont exist',
    ]);
$slackAttachment->addField($unicornAttachmentField);
$slackAttachment->addAction($unicornAttachmentAction);

$slackNotification = (new SlackNotification)
    ->toHook('abc\123\xyz')
    ->withUsername('Newt Scamander')
    ->withIcon('unicorn_face')
    ->toChannel('#mythical_beasts')
    ->withTitle('Testing Slack Notification')
    ->withText('Just checking to make sure the notification goes through')
    ->unfurlLinks(false)
    ->unfurlMedia(false);
    ->withAttachments([$slackAttachment])
    ->send();

```

Notification configured with an array
-------------------------------------

[](#notification-configured-with-an-array)

At the top of the class file where you wish to use:

```
use DealerInspire\SlackNotifications\SlackNotification;

```

In your class code:

```
$slackAttachmentConfiguration = [
    [
        'fallback' => 'The Mythical Animal is a Unicorn',
        'title' => 'What are Mythical Animals?',
        'text' => 'Mythical animals are creatures that dont exist',
        'actions' => [
            [
                'text' => 'Find more about Unicorns',
                'url' => 'https://en.wikipedia.org/wiki/Unicorn',
            ],
        ],
        'fields' => [
            [
                'title' => 'Mythical Animal',
                'value' => 'Unicorn',
                'short' => true,
            ],
        ],
    ],
];

$slackNotification = (new SlackNotification)
    ->toHook('abc\123\xyz')
    ->withUsername('Newt Scamander')
    ->withIcon('unicorn_face')
    ->toChannel('#mythical_beasts')
    ->withTitle('Testing Slack Notification')
    ->withText('Just checking to make sure the notification goes through')
    ->unfurlLinks(false)
    ->unfurlMedia(false);
    ->withAttachments($slackAttachmentConfiguration)
    ->send();

```

Using Environmental Variables
-----------------------------

[](#using-environmental-variables)

You may also use environmental variables to default some settings. The environmental variables are contained within your project's .env file.

```
SLACK_HOOK_PATH=abc\123\xyz
SLACK_USERNAME=Newt Scamander
SLACK_ICON=unicorn_face
SLACK_CHANNEL=#mythical_beasts

```

When you use environmental variables this, a basic use case can become even simpler. Of course, you can always overwrite these settings with the methods shown in the examples above.

At the top of the class file where you wish to use:

```
use DealerInspire\SlackNotifications\SlackNotification;

```

In your class code:

```
(new SlackNotification)
    ->withTitle('Testing Slack Notification')
    ->withText('Just checking to make sure the notification goes through')
    ->send();

```

Contributing
------------

[](#contributing)

See the [CONTRIBUTING](CONTRIBUTING.md) guide.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~94 days

Recently: every ~118 days

Total

6

Last Release

1783d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

1.1.2PHP ^7.2.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f584dc7d204c3339a0aa09494963caa17078d6cab4216bb2c5e2d90efe03d5fe?d=identicon)[michalcarson](/maintainers/michalcarson)

![](https://www.gravatar.com/avatar/60324d72e7a3c7dea85699215cb194d3962647df1e860ae0ec1c6d53858e9a9b?d=identicon)[skybluesofa](/maintainers/skybluesofa)

![](https://www.gravatar.com/avatar/b9bda52297f3865fd612a3977e38907e4f033db58d64426fa1e432056a54f289?d=identicon)[fredjiles](/maintainers/fredjiles)

---

Top Contributors

[![skybluesofa](https://avatars.githubusercontent.com/u/1657128?v=4)](https://github.com/skybluesofa "skybluesofa (24 commits)")

---

Tags

notificationsslacknotificationsslack

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dealerinspire-slack-notifications/health.svg)

```
[![Health](https://phpackages.com/badges/dealerinspire-slack-notifications/health.svg)](https://phpackages.com/packages/dealerinspire-slack-notifications)
```

###  Alternatives

[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[beyondcode/slack-notification-channel

Slack Notification Channel for Laravel using API tokens.

85525.8k](/packages/beyondcode-slack-notification-channel)[tuyakhov/yii2-notifications

The extension provides support for sending notifications across a variety of delivery channels, including mail, SMS, Slack etc. Notifications may also be stored in a database so they may be displayed in your web interface.

6735.5k2](/packages/tuyakhov-yii2-notifications)[craftpulse/craft-notifications

Send notifications across a variety of delivery channels, including mail and Slack. Notifications may also be stored in a database so they may be displayed in your web interface.

551.2k](/packages/craftpulse-craft-notifications)[dmitrovskiy/ionic-push-php

ionic push notifications php sdk

215.5k1](/packages/dmitrovskiy-ionic-push-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
