PHPackages                             amiriskander/slack-notifier - 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. amiriskander/slack-notifier

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

amiriskander/slack-notifier
===========================

A simple package that can be used to build and send Slack messages

v2.1.0(4y ago)113.4k↓50%MITPHPPHP &gt;=7.1

Since Oct 28Pushed 4y ago1 watchersCompare

[ Source](https://github.com/amiriskander/slack-notifier)[ Packagist](https://packagist.org/packages/amiriskander/slack-notifier)[ RSS](/packages/amiriskander-slack-notifier/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (6)Used By (0)

Slack Notifier
==============

[](#slack-notifier)

[![Build Status](https://camo.githubusercontent.com/25796d7866dd557af5b7fa2ef9ef4ad83d5e1c393446e9b98f21da748221b54f/68747470733a2f2f7472617669732d63692e6f72672f616d697269736b616e6465722f736c61636b2d6e6f7469666965722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/amiriskander/slack-notifier) [![Latest Stable Version](https://camo.githubusercontent.com/192fe449f045fa777a0502272215f4a0a301301a1ef64f59c884ecf5acb57671/68747470733a2f2f706f7365722e707567782e6f72672f616d697269736b616e6465722f736c61636b2d6e6f7469666965722f76657273696f6e)](https://packagist.org/packages/amiriskander/slack-notifier) [![Total Downloads](https://camo.githubusercontent.com/8ec12c5c3f431965a521915e43a416c1db8a23ffba537811cd3e4a0359af554b/68747470733a2f2f706f7365722e707567782e6f72672f616d697269736b616e6465722f736c61636b2d6e6f7469666965722f646f776e6c6f616473)](https://packagist.org/packages/amiriskander/slack-notifier) [![License](https://camo.githubusercontent.com/7bb984174b0c8bf03f0002ad35ba290e6b43750e47cfc8a4b09896b1905fd724/68747470733a2f2f706f7365722e707567782e6f72672f616d697269736b616e6465722f736c61636b2d6e6f7469666965722f6c6963656e7365)](https://packagist.org/packages/amiriskander/slack-notifier)

A simple PHP package that can be used to build and send Slack messages

### Requirements

[](#requirements)

- PHP &gt;= 7.1
- PHP cURL Extension
- PHP JSON Extension

### Installation

[](#installation)

```
composer require amiriskander/slack-notifier

```

### Usage

[](#usage)

There is no massive effort you need to create a simple text message like `Hello, World!`

```
use AmirIskander\SlackNotifier;

public function TestHelloWorld()
{
    $message = new Message()
        ->addBlock(new Section()->setText(new PlainText('Hello, World!')));
        ->send('https://hooks.slack.com/services/....')
    ;
}

```

The package supports block types:

- Divider: A horizontal gray divider.
- Section: A container that can contain multiple components.

And a block of type section can have components of types:

- Text: Can be either `Plain Text` or `Markdown`
- Accessory: Can be either `Button` or `Image`

For more complex examples that needs adding blocks with images, links and buttons, it is not a big problem. Check the below example:

```
use AmirIskander\SlackNotifier;

public function TestSendSlackMessage()
{
    $message = new Message();
    $block   = new Block('section');
    $block->setText(new Text('mrkdwn', 'John Doe submitted a feedback!'));
    $message->addBlock($block);

    $block   = new Block('divider');
    $message->addBlock($block);

    $block   = new Block('section');
    $block->setText(new Text('mrkdwn', ':new: *You guys are awesome. Keep up the good work!*'));
    $message->addBlock($block);

    $block   = new Block('section');
    $block->setText(new Text('mrkdwn', '*Source* :information_source: Homepage Feedback Form'));
    $message->addBlock($block);

    $block   = new Block('section');
    $block->setText(new Text('mrkdwn', '*In the last 30 days*'));
    $block->addField(new Text('mrkdwn', 'Submitted 6 form submissions'));
    $block->addField(new Text('mrkdwn', 'Rated 12 products'));
    $accessory = new Accessory('image');
    $accessory->setImageUrl('https://i.ibb.co/19W2sdD/stat.png');
    $accessory->setAltText('Stats');
    $block->setAccessory($accessory);
    $message->addBlock($block);

    $block   = new Block('divider');
    $message->addBlock($block);

    $block   = new Block('section');
    $block->setText(new Text('mrkdwn', 'More information about this user'));
    $accessory = new Accessory('button');
    $accessory->setUrl('https://yourwebsite/user/123/profile/');
    $accessory->setText(new Text('plain_text', ':bust_in_silhouette: View User'));
    $accessory->setValue('view_user_btn');
    $block->setAccessory($accessory);
    $message->addBlock($block);

    // Replace parameter below with webhook of channel you would like to post to
    $message->send('https://hooks.slack.com/services/....');
}

```

The same example using classes for Button, Image, Section, Divider

```
use AmirIskander\SlackNotifier;

public function TestSendSlackMessage()
{
    // Init Message object
    $message = new Message();

    // Adding a section
    $block   = new Section();
    $block->setText(new MarkdownText('John Doe submitted a feedback!'));
    $message->addBlock($block);

    // Adding a divider
    $message->addBlock(new Divider());

    $block   = new Section();
    $block->setText(new MarkdownText(':new: *You guys are awesome. Keep up the good work!*'));
    $message->addBlock($block);

    $block   = new Section();
    $block->setText(new MarkdownText('*Source* :information_source: Homepage Feedback Form'));
    $message->addBlock($block);

    $block   = new Section();
    $block->setText(new MarkdownText('*In the last 30 days*'));
    $block->addField(new MarkdownText('Submitted 6 form submissions'));
    $block->addField(new MarkdownText('Rated 12 products'));
    $accessory = new Image('https://i.ibb.co/19W2sdD/stat.png', 'Stats');
    $block->setAccessory($accessory);
    $message->addBlock($block);

    $message->addBlock(new Divider());

    $block   = new Section();
    $block->setText(new MarkdownText('More information about this user'));
    $block->setAccessory(new Button(
        'https://yourwebsite/user/123/profile/',
        ':bust_in_silhouette: View User'
    ));
    $message->addBlock($block);

    // Replace parameter below with webhook of channel you would like to post to
    $message->send('https://hooks.slack.com/services/....');
}

```

### Screenshot

[](#screenshot)

[![Sample message screenshot](screenshot.png "Sample message screenshot")](screenshot.png)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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 ~118 days

Total

5

Last Release

1556d ago

Major Versions

v1.1 → v2.02020-10-28

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6437189?v=4)[Amir Iskander](/maintainers/amiriskander)[@amiriskander](https://github.com/amiriskander)

---

Top Contributors

[![amiriskander](https://avatars.githubusercontent.com/u/6437189?v=4)](https://github.com/amiriskander "amiriskander (3 commits)")

---

Tags

messagesymfonylaravelnotificationnotifierslackintegration

### Embed Badge

![Health badge](/badges/amiriskander-slack-notifier/health.svg)

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

###  Alternatives

[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[yieldstudio/laravel-expo-notifier

Easily send Expo notifications with Laravel.

59115.9k](/packages/yieldstudio-laravel-expo-notifier)[ras/flash-alert-bundle

FlashAlertBundle provides a simplified way to handle (add/display) Symfony flash messages. Client side scripts are written in pure JavaScript.

2423.3k](/packages/ras-flash-alert-bundle)[bpocallaghan/alert

A helper package to flash a bootstrap alert to the browser.

1819.6k3](/packages/bpocallaghan-alert)

PHPackages © 2026

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