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

ActiveSymfony-notifier-bridge[Mail &amp; Notifications](/categories/mail)

symfony/slack-notifier
======================

Symfony Slack Notifier Bridge

v8.0.4(4mo ago)426.1M↓10.9%119MITPHPPHP &gt;=8.4

Since Nov 11Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/symfony/slack-notifier)[ Packagist](https://packagist.org/packages/symfony/slack-notifier)[ Docs](https://symfony.com)[ Fund](https://symfony.com/sponsor)[ GitHub Sponsors](https://github.com/fabpot)[ RSS](/packages/symfony-slack-notifier/feed)WikiDiscussions 8.1 Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (147)Used By (9)

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

[](#slack-notifier)

Provides [Slack](https://slack.com) integration for Symfony Notifier.

DSN example
-----------

[](#dsn-example)

```
SLACK_DSN=slack://TOKEN@default?channel=CHANNEL

```

where:

- `TOKEN` is your Bot User OAuth Access Token (they begin with `xoxb-`)
- `CHANNEL` is a channel, private group, or IM channel to send message to, it can be an encoded ID, or a name.

valid DSN's are:

```
SLACK_DSN=slack://xoxb-......@default?channel=my-channel-name
SLACK_DSN=slack://xoxb-......@default?channel=@fabien

```

invalid DSN's are:

```
SLACK_DSN=slack://xoxb-......@default?channel=#my-channel-name
SLACK_DSN=slack://xoxb-......@default?channel=fabien

```

Adding Interactions to a Message
--------------------------------

[](#adding-interactions-to-a-message)

With a Slack message, you can use the `SlackOptions` class to add some interactive options called [Block elements](https://api.slack.com/reference/block-kit/block-elements).

```
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackActionsBlock;
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackDividerBlock;
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackImageBlockElement;
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock;
use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('Contribute To Symfony');

// Create Slack Actions Block and add some buttons
$contributeToSymfonyBlocks = (new SlackActionsBlock())
    ->button(
        'Improve Documentation',
        'https://symfony.com/doc/current/contributing/documentation/standards.html',
        'primary'
    )
    ->button(
        'Report bugs',
        'https://symfony.com/doc/current/contributing/code/bugs.html',
        'danger',
        null,
        [
            'title' => ['type' => 'plaint_text', 'text' => 'Report a bug'],
            'text' => ['type' => 'plaint_text', 'text' => 'By proceeding I confirm I\'ve read the guidelines.'],
            'confirm' => ['type' => 'plaint_text', 'text' => 'Proceed'],
            'deny' => ['type' => 'plaint_text', 'text' => 'Go back to reading']
        ]
    );

$slackOptions = (new SlackOptions())
    ->block((new SlackSectionBlock())
        ->text('The Symfony Community')
        ->accessory(
            new SlackImageBlockElement(
                'https://symfony.com/favicons/apple-touch-icon.png',
                'Symfony'
            )
        )
    )
    ->block(new SlackDividerBlock())
    ->block($contributeToSymfonyBlocks);

// Add the custom options to the chat message and send the message
$chatMessage->options($slackOptions);

$chatter->send($chatMessage);
```

Alternatively, a single button can be added to a section using the `accessory()` method and the `SlackButtonBlockElement` class.

```
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackButtonBlockElement;
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackDividerBlock;
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock;
use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('Contribute To Symfony');

$slackOptions = (new SlackOptions())
    ->block((new SlackSectionBlock())
        ->text('Symfony Framework')
        ->accessory(
            new SlackButtonBlockElement(
                'Report bugs',
                'https://symfony.com/doc/current/contributing/code/bugs.html',
                'danger'
            )
        )
    )
    ->block(new SlackDividerBlock())
    ->block((new SlackSectionBlock())
        ->text('Symfony Documentation')
        ->accessory(
            new SlackButtonBlockElement(
                'Improve Documentation',
                'https://symfony.com/doc/current/contributing/documentation/standards.html',
                'primary'
            )
        )
    );

// Add the custom options to the chat message and send the message
$chatMessage->options($slackOptions);

$chatter->send($chatMessage);
```

Adding Fields and Values to a Message
-------------------------------------

[](#adding-fields-and-values-to-a-message)

To add fields and values to your message you can use the `field()` method.

```
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackDividerBlock;
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock;
use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('Symfony Feature');

$options = (new SlackOptions())
    ->block((new SlackSectionBlock())->text('My message'))
    ->block(new SlackDividerBlock())
    ->block(
        (new SlackSectionBlock())
            ->field('*Max Rating*')
            ->field('5.0')
            ->field('*Min Rating*')
            ->field('1.0')
    );

// Add the custom options to the chat message and send the message
$chatMessage->options($options);

$chatter->send($chatMessage);
```

Define text objects properties
------------------------------

[](#define-text-objects-properties)

[Text objects properties](https://api.slack.com/reference/block-kit/composition-objects#text) can be set on any `text()` or `field()` method :

```
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock;
use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('Slack Notifier');

$options = (new SlackOptions())
    ->block(
        (new SlackSectionBlock())
            ->field('My **Markdown** content with clickable URL : symfony.com') // Markdown content (default)
            ->field('*Plain text content*', markdown: false) // Plain text content
            ->field('Not clickable URL : symfony.com', verbatim: true) // Only for markdown content
            ->field('Thumbs up emoji code is :thumbsup: ', emoji: false) // Only for plain text content
    );

// Add the custom options to the chat message and send the message
$chatMessage->options($options);

$chatter->send($chatMessage);
```

Adding a Header to a Message
----------------------------

[](#adding-a-header-to-a-message)

To add a header to your message use the `SlackHeaderBlock` class.

```
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackDividerBlock;
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackHeaderBlock;
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock;
use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('Symfony Feature');

$options = (new SlackOptions())
    ->block((new SlackHeaderBlock('My Header')))
    ->block((new SlackSectionBlock())->text('My message'))
    ->block(new SlackDividerBlock())
    ->block(
        (new SlackSectionBlock())
            ->field('*Max Rating*')
            ->field('5.0')
            ->field('*Min Rating*')
            ->field('1.0')
    );

// Add the custom options to the chat message and send the message
$chatMessage->options($options);

$chatter->send($chatMessage);
```

Adding a Footer to a Message
----------------------------

[](#adding-a-footer-to-a-message)

To add a header to your message use the `SlackContextBlock` class.

```
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackContextBlock;
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackDividerBlock;
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock;
use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('Symfony Feature');

$contextBlock = (new SlackContextBlock())
    ->text('My Context')
    ->image('https://symfony.com/logos/symfony_white_03.png', 'Symfony Logo')
;

$options = (new SlackOptions())
    ->block((new SlackSectionBlock())->text('My message'))
    ->block(new SlackDividerBlock())
    ->block(
        (new SlackSectionBlock())
            ->field('*Max Rating*')
            ->field('5.0')
            ->field('*Min Rating*')
            ->field('1.0')
    )
    ->block($contextBlock)
;

// Add the custom options to the chat message and send the message
$chatMessage->options($options);

$chatter->send($chatMessage);
```

Sending a Message as a Reply
----------------------------

[](#sending-a-message-as-a-reply)

To send your Slack message as a reply in a thread use the `threadTs()` method.

```
use Symfony\Component\Notifier\Bridge\Slack\Block\SlackSectionBlock;
use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('Symfony Feature');

$options = (new SlackOptions())
    ->block((new SlackSectionBlock())->text('My reply'))
    ->threadTs('1621592155.003100')
;

// Add the custom options to the chat message and send the message
$chatMessage->options($options);

$chatter->send($chatMessage);
```

Updating a Slack Message
------------------------

[](#updating-a-slack-message)

First, save the message ID and channel ID when sending a message:

```
use Symfony\Component\Notifier\Bridge\Slack\SlackSentMessage;
use Symfony\Component\Notifier\Message\ChatMessage;

$sentMessage = $chatter->send(new ChatMessage('Original message'));

// Make sure that Slack transport was used
if ($sentMessage instanceOf SlackSentMessage) {
    $messageId = $sentMessage->getMessageId();
    $channelId = $sentMessage->getChannelId();
}
```

Then, use that message ID and channel ID to create a new `UpdateMessageSlackOptions` class:

```
use Symfony\Component\Notifier\Bridge\Slack\UpdateMessageSlackOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$options = new UpdateMessageSlackOptions($channelId, $messageId);
$chatter->send(new ChatMessage('Updated message', $options));
```

Scheduling a Slack Message
--------------------------

[](#scheduling-a-slack-message)

To schedule a message to be sent at a later time, use the `postAt()` method:

```
use Symfony\Component\Notifier\Bridge\Slack\SlackOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$options = (new SlackOptions())->postAt(new \DateTime('+1 day'));

$chatMessage = new ChatMessage('Symfony Feature');
$chatMessage->options($options);

$chatter->send($chatMessage);
```

Resources
---------

[](#resources)

- [Contributing](https://symfony.com/doc/current/contributing/index.html)
- [Report issues](https://github.com/symfony/symfony/issues) and [send Pull Requests](https://github.com/symfony/symfony/pulls)in the [main Symfony repository](https://github.com/symfony/symfony)

###  Health Score

69

—

FairBetter than 100% of packages

Maintenance77

Regular maintenance activity

Popularity57

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity93

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~6 days

Total

147

Last Release

110d ago

Major Versions

v6.4.13 → v7.1.62024-09-25

v6.4.24 → v7.4.0-BETA12025-10-12

v7.4.0-RC1 → v8.0.02025-10-13

6.4.x-dev → 7.3.x-dev2026-01-05

v7.4.4 → 8.0.x-dev2026-01-05

PHP version history (7 changes)v5.0.0-RC1PHP ^7.2.9

v5.0.0PHP ^7.2.5

v5.0.10PHP &gt;=7.2.5

v6.0.0-BETA1PHP &gt;=8.0.2

v6.1.0PHP &gt;=8.1

v7.0.0-RC1PHP &gt;=8.2

v8.0.0PHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/47313?v=4)[Fabien Potencier](/maintainers/fabpot)[@fabpot](https://github.com/fabpot)

---

Top Contributors

[![nicolas-grekas](https://avatars.githubusercontent.com/u/243674?v=4)](https://github.com/nicolas-grekas "nicolas-grekas (96 commits)")[![fabpot](https://avatars.githubusercontent.com/u/47313?v=4)](https://github.com/fabpot "fabpot (59 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (24 commits)")[![derrabus](https://avatars.githubusercontent.com/u/1506493?v=4)](https://github.com/derrabus "derrabus (23 commits)")[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (19 commits)")[![norkunas](https://avatars.githubusercontent.com/u/2722872?v=4)](https://github.com/norkunas "norkunas (6 commits)")[![alexandre-daubois](https://avatars.githubusercontent.com/u/2144837?v=4)](https://github.com/alexandre-daubois "alexandre-daubois (4 commits)")[![birkof](https://avatars.githubusercontent.com/u/65848?v=4)](https://github.com/birkof "birkof (3 commits)")[![jderusse](https://avatars.githubusercontent.com/u/578547?v=4)](https://github.com/jderusse "jderusse (3 commits)")[![keradus](https://avatars.githubusercontent.com/u/2716794?v=4)](https://github.com/keradus "keradus (2 commits)")[![chalasr](https://avatars.githubusercontent.com/u/7502063?v=4)](https://github.com/chalasr "chalasr (2 commits)")[![cvergne](https://avatars.githubusercontent.com/u/1032689?v=4)](https://github.com/cvergne "cvergne (2 commits)")[![fancyweb](https://avatars.githubusercontent.com/u/3658119?v=4)](https://github.com/fancyweb "fancyweb (2 commits)")[![GromNaN](https://avatars.githubusercontent.com/u/400034?v=4)](https://github.com/GromNaN "GromNaN (2 commits)")[![iamvar](https://avatars.githubusercontent.com/u/7314366?v=4)](https://github.com/iamvar "iamvar (2 commits)")[![malteschlueter](https://avatars.githubusercontent.com/u/13586874?v=4)](https://github.com/malteschlueter "malteschlueter (2 commits)")[![WaylandAce](https://avatars.githubusercontent.com/u/1263005?v=4)](https://github.com/WaylandAce "WaylandAce (2 commits)")[![maxim-dovydenok-busuu](https://avatars.githubusercontent.com/u/88774580?v=4)](https://github.com/maxim-dovydenok-busuu "maxim-dovydenok-busuu (1 commits)")[![miloszowi](https://avatars.githubusercontent.com/u/32432158?v=4)](https://github.com/miloszowi "miloszowi (1 commits)")[![MrYamous](https://avatars.githubusercontent.com/u/32437818?v=4)](https://github.com/MrYamous "MrYamous (1 commits)")

---

Tags

componentnotifierphpslacksymfonysymfony-componentnotifierslack

### Embed Badge

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

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

###  Alternatives

[symfony/fake-sms-notifier

Fake SMS (as email or log during development) Notifier Bridge.

27754.2k1](/packages/symfony-fake-sms-notifier)[symfony/discord-notifier

Symfony Discord Notifier Bridge

37387.7k2](/packages/symfony-discord-notifier)[symfony/twilio-notifier

Symfony Twilio Notifier Bridge

131.2M2](/packages/symfony-twilio-notifier)[symfony/fake-chat-notifier

Fake Chat (as email or log during development) Notifier Bridge.

10260.2k4](/packages/symfony-fake-chat-notifier)[symfony/free-mobile-notifier

Symfony Free Mobile Notifier Bridge

2061.6k](/packages/symfony-free-mobile-notifier)[symfony/mattermost-notifier

Symfony Mattermost Notifier Bridge

10156.2k](/packages/symfony-mattermost-notifier)

PHPackages © 2026

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