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

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

aranyasen/laravel-slack
=======================

A package to send messages to Slack

1.1.1(1y ago)01.4kMITPHPPHP &gt;=8.2

Since Apr 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/senaranya/laravel-slack)[ Packagist](https://packagist.org/packages/aranyasen/laravel-slack)[ RSS](/packages/aranyasen-laravel-slack/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (7)Used By (0)

[![CI Status](https://github.com/senaranya/laravel-slack/actions/workflows/main_ci.yml/badge.svg?branch=master)](https://github.com/senaranya/laravel-slack/actions)[![Total Downloads](https://camo.githubusercontent.com/6193b23e0eb06ae1d6a8a1f7900c03cfb2998d258cfafc4d1e0ac72d2571567f/68747470733a2f2f706f7365722e707567782e6f72672f6172616e796173656e2f6c61726176656c2d736c61636b2f646f776e6c6f616473)](https://packagist.org/packages/aranyasen/laravel-slack)[![Latest Stable Version](https://camo.githubusercontent.com/c9806bc26b2e28e888590e5bc5e30571f00bcab12f73cd79d4ac54c1b4e5a742/68747470733a2f2f706f7365722e707567782e6f72672f6172616e796173656e2f6c61726176656c2d736c61636b2f762f737461626c65)](https://packagist.org/packages/aranyasen/laravel-slack)[![License](https://camo.githubusercontent.com/9874a352da9cabc9e6fdee8e191530f7d95764d660c7f002cee41b3f2ed58d0c/68747470733a2f2f706f7365722e707567782e6f72672f6172616e796173656e2f6c61726176656c2d736c61636b2f6c6963656e7365)](https://packagist.org/packages/aranyasen/laravel-slack)

Laravel Slack
=============

[](#laravel-slack)

This package allows you to easily compose and send Slack messages from Laravel applications

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

[](#installation)

Step-1:

```
composer require aranyasen/laravel-slack
```

Step-2: Publish the config:

```
php artisan vendor:publish --provider=Aranyasen\\LaravelSlack\\SlackServiceProvider
```

It creates `config/laravel-slack.php`.

Step-3: Add parameters `SLACK_WORKSPACE` and `SLACK_TOKEN` in .env
(See reference below on how to generate a Slack API token)

### Usage

[](#usage)

```
// Send a simple message to a channel, say "some-channel"
(new SlackNotification())
    ->channel('some-channel')
    ->text("Hello!")
    ->send();

// Send a section (Ref: https://api.slack.com/reference/block-kit/blocks#section)
(new SlackNotification())
    ->channel('some-channel')
    ->section() // Starts a section
    ->fields() // Starts a field in this section
    ->markdown(":fire: @here This is an emergency :fire:")
    ->endFields()
    ->endSection()
    ->send();

// Send a raw JSON block (example from https://api.slack.com/block-kit/building#block_basics)
(new SlackNotification())
    ->channel('some-channel')
    ->block([
      "type" => "section",
      "text" => [
        "type" => "mrkdwn",
        "text" => "New Paid Time Off request from \n\n",
      ],
    ])
    ->send();

// Compose a message and dump the JSON that'll be sent to Slack. Useful for debugging.
(new SlackNotification())
    ->channel('some-channel')
    ->text("Hello!")
    ->dump();

// Upload a file
(new SlackNotification())
    ->channel('some-channel')
    ->file($filePath, 'Some filename')
    ->upload();

// Optionally, a title, or an accompanying message can be added with a file
(new SlackNotification())
    ->channel('some-channel')
    ->file($filePath, 'Some filename')
    ->withInitialComment('some comment')
    ->withTitle('some title')
    ->upload();
```

#### APIs:

[](#apis)

`channel()` -&gt; Channel
`header()` -&gt; Create a header section
`context()` -&gt; A small footer text
`divider()` -&gt; A horizontal line
`section()` / `endSection()` --&gt; A section block
`lists()` -&gt; List of items
`field()` / `endfield()` --&gt; Inside section
`markdown()` -&gt; A markdown block, allowed only inside a section
`block()` -&gt; Pre-composed block
`send()` -&gt; Send to Slack
`dump()` -&gt; Dump the final JSON that'd be sent to Slack API `file()` -&gt; Upload a file
`withInitialComment()` -&gt; Add a message with a file upload `withTitle()` -&gt; Add a title with file upload

### Testing:

[](#testing)

Invoke `SlackNotification::fake()` to ensure HTTP requests to Slack are mocked. Internally it uses Laravel's [Http::fake()](https://laravel.com/docs/10.x/http-client#testing), so all available `Http::assert*` methods can be used for assertions. Example:

```
SlackNotification::fake();
(new SlackNotification())
    ->channel('channel-1')
    ->send();
Http::assertSent(static fn(Request $request) => $request['channel'] === 'channel-1');
```

### References:

[](#references)

#### To create a Slack API token

[](#to-create-a-slack-api-token)

- Visit
- If no app is present, create an app (you may select "from scratch")
- If the app was created earlier, select the app under *App Name*
- On the left pane, under "Features" click "OAuth &amp; Permissions"
- Under *Scopes* &gt; *Bot Token Scopes*, click *Add an OAuth Scope*
- Add these scopes: `chat.write` and `chat.write.public`.
    (note: `channels.read`, `users.read` may be needed in future versions of this package, but not now)
- Click "*reinstall your app*" in the yellow bar that appears above
- In the dropdown "Search for a channel", select a channel. Any channel would do - won't matter now.
- Allow it
- Copy the "*Bot User OAuth Token*" and share

#### Links:

[](#links)

- Slack Block reference docs:
- Emoji cheat-sheet:
- Color bar not supported in block kits yet (ref: )

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

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

Total

5

Last Release

685d ago

Major Versions

0.0.2 → 1.0.02023-08-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/16dd57009f577d06da0eb45b9020ed46e7da99b2e26eda5dde49da9f74e66612?d=identicon)[senaranya](/maintainers/senaranya)

---

Top Contributors

[![senaranya](https://avatars.githubusercontent.com/u/5471894?v=4)](https://github.com/senaranya "senaranya (28 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[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/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[illuminate/mail

The Illuminate Mail package.

5910.1M391](/packages/illuminate-mail)

PHPackages © 2026

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