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

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

cian/slack
==========

A PHP package for sending messages to Slack.

1.2.0(5y ago)011.0kMITPHPPHP &gt;=7.0CI failing

Since Nov 3Pushed 5y ago1 watchersCompare

[ Source](https://github.com/cian6390/slack)[ Packagist](https://packagist.org/packages/cian/slack)[ RSS](/packages/cian-slack/feed)WikiDiscussions master Synced 4d ago

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

Slack for PHP
=============

[](#slack-for-php)

[![Build Status](https://camo.githubusercontent.com/2ca3feb96c134348ecd9e120d5fd0fb1f95312de4e98d71c3564fd6b7f583c22/68747470733a2f2f7472617669732d63692e636f6d2f6369616e363339302f736c61636b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/cian6390/slack)[![Latest Stable Version](https://camo.githubusercontent.com/d357e044ba367d3c5c9aae7aad67b1f9290762ce45a069d4a702ecd4553041ca/68747470733a2f2f706f7365722e707567782e6f72672f6369616e2f736c61636b2f762f737461626c65)](https://packagist.org/packages/cian/slack)[![Total Downloads](https://camo.githubusercontent.com/62ef637ac006792cdb065d126881d478603a7d9282fe4e3a93d82b2e9f7306bd/68747470733a2f2f706f7365722e707567782e6f72672f6369616e2f736c61636b2f646f776e6c6f616473)](https://packagist.org/packages/cian/slack)[![License](https://camo.githubusercontent.com/44141cae0184d4977bc88d01c8c449049d83e2f3c49440100ec2c025b306a120/68747470733a2f2f706f7365722e707567782e6f72672f6369616e2f736c61636b2f6c6963656e7365)](https://packagist.org/packages/cian/slack)

Requirements
------------

[](#requirements)

- PHP 7.0+

Installation
------------

[](#installation)

```
composer require cian/slack

```

### Laravel

[](#laravel)

```
php artisan vendor:publish --provider="Cian\Slack\LaravelServiceProvider"
```

If your laravel version `send($message, $url);
```

### Interactive Message

[](#interactive-message)

To use interactive message, you need to set up `OAuth & Permissions` of your app. After that, you can send the message like below.

```
use Cian\Slack\InteractiveMessage;

$token = 'your-app-token';

// $channel can be channel_name, channel_id, user_slack_id
// but Slack suggests not to use channel_name.
$channel = 'development';

$message = 'Hello Interactive Message!';

(new InteractiveMessage([
    'token' => $token,
    'channel' => $channel
]))->send($message);

// or

(new InteractiveMessage)
    ->setToken($token)
    ->to($channel)
    ->send($message);
```

### Block

[](#block)

Slack suggests to use `Block` instead of `Attachment`
because `Block` is more flexible than `Attachment`.

```
use Cian\Slack\IncomingWebhook;
use Cian\Slack\Builders\BlockBuilder;

$url = 'https://hooks.slack.com/services/path/to/your/incoming-webhook/url';

$builder = (new BlockBuilder)
    ->section('*A Title Here*')
    ->section('body content ...')
    ->divider()
    ->section('😗😗😗');

(new IncomingWebhook)->send($builder, $url)
```

### Attachment

[](#attachment)

Even Slack suggests to use `Block` instead of `Attachment`,
it won't remove the `Attachment`.

`Attachment` has a lot of fields, but they are all legacy.
[check slack attachment document to know more](https://api.slack.com/reference/messaging/attachments)

The best way of using Attachment is keep only two fields, `blocks` and `color`.

```
use Cian\Slack\IncomingWebhook;
use Cian\Slack\Builders\BlockBuilder;
use Cian\Slack\Builders\AttachmentBuilder;

$blockBuilder = (new BlockBuilder)->section('How are you?');

// when you provide block builder as the first argument
// the second argument color will be applied
// the color can be 'good', 'warning', 'danger' or any valid hex color code.
$attachments = (new AttachmentBuilder($blockBuilder, '#ff0000'));

$url = 'https://hooks.slack.com/services/path/to/your/incoming-webhook/url';

(new IncomingWebhook)
    ->send($attachments, $url);
```

Let's say if you still need legacy fields,
you can do it like below.

```
use Cian\Slack\IncomingWebhook;
use Cian\Slack\Builders\AttachmentBuilder;

$attachments = (new AttachmentBuilder)->add([
    'text' => '😗😗😗',
    'fallback' => 'fall back text...',
    'footer' => 'footer text...',
    'color' => 'danger'
    // ... more legacy fields
]);

$url = 'https://hooks.slack.com/services/path/to/your/incoming-webhook/url';

(new IncomingWebhook)
    ->send($attachments, $url);
```

Let's say you are facing a very complex scenario,
you would need to use blocks and attachments together.

```
use Cian\Slack\Message;
use Cian\Slack\IncomingWebhook;
use Cian\Slack\Builders\BlockBuilder;
use Cian\Slack\Builders\AttachmentBuilder;

$titleBlocker = (new BlockBuilder)
    ->section('Title row 😗😗😗');

$bodyBlocker = (new BlockBuilder)
    ->section('body content ...')
    ->divider();

$attachmenter = (new AttachmentBuilder($bodyBlocker, '#ff00ff'));

$message = new Message($titleBlocker);

$message->setAttachments($attachmenter);

$url = 'https://hooks.slack.com/services/path/to/your/incoming-webhook/url';

(new IncomingWebhook)
    ->send($message, $url);
```

Although I use `IncomingWebhook` in document examples,
it can be replaced by `InteractiveMessage`.

Interactive Component
---------------------

[](#interactive-component)

### Button

[](#button)

```
use Cian\Slack\IncomingWebhook;
use Cian\Slack\Builders\BlockBuilder;
use Cian\Slack\Builders\ElementBuilder;

$text = 'Approve';
$actionId = 'approve_request';
$value = ['foo' => 'bar'];  // optional default ''
$style = 'primary';         // optional default 'primary'
$type = 'plain_text';       // optional default `plain_text`
$button = ElementBuilder::makeButton($text, $actionId, $value, $style, $type);
// or $button = (new ElementBuilder)->button(/** same as makeButton */);

$blocker = (new BlockBuilder)
    ->section('*Can I buy a toy ?*')
    ->divider()
    ->actions([$button]);

$url = 'https://hooks.slack.com/services/path/to/your/incoming-webhook/url';

(new IncomingWebhook)->to($url)->send($blocker);
// or (new IncomingWebhook)->send($blocker, $url);
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Recently: every ~93 days

Total

6

Last Release

2013d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16318147?v=4)[cian6390](/maintainers/cian6390)[@cian6390](https://github.com/cian6390)

---

Top Contributors

[![cian6390](https://avatars.githubusercontent.com/u/16318147?v=4)](https://github.com/cian6390 "cian6390 (5 commits)")

---

Tags

phpslack

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[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)[brian2694/laravel-toastr

toastr.js for Laravel

136649.4k5](/packages/brian2694-laravel-toastr)[php-flasher/flasher-laravel

Seamlessly integrate flash notifications into your Laravel applications with PHPFlasher. Enhance user feedback and engagement with minimal setup.

442.8M35](/packages/php-flasher-flasher-laravel)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)

PHPackages © 2026

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