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

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

michaelthuren/slack-laravel-client
==================================

Slack notification for Laravel as it should be.

9.0.1(3y ago)02.5kMITPHPPHP ^8.0

Since Sep 30Pushed 3y ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (4)Used By (0)

[![](https://camo.githubusercontent.com/b33fcc2b0c64408ee88de17494f6e0c506dc5b89624c7b463b49a20f836629ce/68747470733a2f2f7365656b6c6f676f2e636f6d2f696d616765732f532f736c61636b2d6c6f676f2d444534343435303737432d7365656b6c6f676f2e636f6d2e706e67)](https://camo.githubusercontent.com/b33fcc2b0c64408ee88de17494f6e0c506dc5b89624c7b463b49a20f836629ce/68747470733a2f2f7365656b6c6f676f2e636f6d2f696d616765732f532f736c61636b2d6c6f676f2d444534343435303737432d7365656b6c6f676f2e636f6d2e706e67)[![](https://camo.githubusercontent.com/640c3d52b2764f179ef3cf089b604516a8c4ac0a06f055a46c6a7fce9428b787/68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667)](https://camo.githubusercontent.com/640c3d52b2764f179ef3cf089b604516a8c4ac0a06f055a46c6a7fce9428b787/68747470733a2f2f6c61726176656c2e636f6d2f6173736574732f696d672f636f6d706f6e656e74732f6c6f676f2d6c61726176656c2e737667)

[![Latest Stable Version](https://camo.githubusercontent.com/c3660d7621f5202ca061431c91d2fd1e62ba2af52f860abd87c3ac15d82b81bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696361656c74687572656e2f736c61636b2d6c61726176656c2d636c69656e742e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/micaelthuren/slack-laravel-client)[![PHP from Packagist](https://camo.githubusercontent.com/58008a2ab05c0f9d8ccb653ceaea1820e723e8cec7bc346b981a4635f2df9185/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d696361656c74687572656e2f736c61636b2d6c61726176656c2d636c69656e742e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/micaelthuren/slack-laravel-client)[![Laravel Version](https://camo.githubusercontent.com/7c88a8982ce58c136c21f864da149a8e767b55add232c164d5c3f2b3c651155c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d253345253344382e302d677265656e2e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/micaelthuren/slack-laravel-client)[![Total Downloads](https://camo.githubusercontent.com/a2c116c96475802bc44b719e79a47c47fc032394dd58f9aca80aa6dd2a864902/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696361656c74687572656e2f736c61636b2d6c61726176656c2d636c69656e742e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/micaelthuren/slack-laravel-client)[![License](https://camo.githubusercontent.com/6960156afb9f045bd9777a63593aefa48bafe442b5c4ec732f7a8a77be15bd43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d696361656c74687572656e2f736c61636b2d6c61726176656c2d636c69656e742e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/micaelthuren/slack-laravel-client)
Based on [illuminate/mail](https://github.com/illuminate/mail)

Slack Laravel Client
--------------------

[](#slack-laravel-client)

Supported Laravel versions 5.5 - 9+

Based on [gpressutto5/laravel-slack](https://github.com/gpressutto5/laravel-slack)

Slack notification for Laravel as it should be. Since it uses On-Demand Notifications, it requires Laravel 5.5 or higher.

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

[](#installation)

Require this package in your composer.json and update your dependencies:

```
composer require michaelthuren/slack-laravel-client
```

Since this package supports Laravel's Package Auto-Discovery you don't need to manually register the ServiceProvider.

After that, publish the configuration file:

```
php artisan vendor:publish --provider="MichaelThuren\SlackLaravelClient\ServiceProvider"
```

You're gonna need to configure an ["Incoming Webhook"](https://api.slack.com/incoming-webhooks) integration for your Slack team.

Configuration
-------------

[](#configuration)

On the published configuration file `config/laravel-slack.php`you can change options like the Webhook URL, the default channel, the application name and the application image.

For security reasons you shouldn't commit your Webhook URL, so this package will, by default, use the environment variable `SLACK_WEBHOOK_URL`. You can just add it to your `.env` file. Like this:

```
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX
```

Usage
-----

[](#usage)

You can send simple Slack messages like this:

- Send message to a channel:

```
\Slack::to('#finance')->send('Hey, finance channel! A new order was created just now!');
```

- Send message to an user:

```
\Slack::to('@joe')->send("Hey Joe! It looks like you've forgotten your password! Use this token to recover it: as34bhdfh");
```

- Send message to multiple users:

```
\Slack::to(['@zoe', '@amy', '@mia'])->send('I swear, honey, you are the only one... :heart:');
//         ↑  look at this array  ↑
```

- Mix it up:

```
\Slack::to('#universe', '@god', '#scientists')->send(':thinking_face:');
//         ↑ what? I don't need that array? ↑
```

- No recipient:

```
\Slack::send('Default message to the default channel, set on config/laravel-slack.php.');
```

- Send SlackMessage objects:

```
class HelloMessage extends SlackMessage
{
    public $content = "Hey bob, I'm a sending a custom SlackMessage";
    public $channel = '@bob';
}
\Slack::send(new SlackMessage());
```

- Send to user:

    You can use any object as a recipient as long as they have the property `slack_channel`. If you are using Models you can just create the column `slack_channel` and store the `@username` or the `#channel` name there. If you already store it but on a different column you can create a method `getSlackChannelAttribute`.

```
class User extends Model
{
    public function getSlackChannelAttribute(): string
    {
        return $this->attributes['my_custom_slack_channel_column'];
    }
}
\Slack::to(User::where('verified', true))->send('Sending message to all verified users!');
```

Testing
-------

[](#testing)

When testing you can easily mock the Slack service by calling `Slack::fake()` it will return a `SlackFake` object that won't send any message for real and will save them to an array. You can get this array by calling `Slack::sentMessages()`.

This class also has some helper methods for you to use when testing:

- Assert that at least one message with the content 'fake' was sent:

```
Slack::assertSent(function (SlackMessage $message) {
    return $message->content === 'fake';
});
```

- Assert that at least two messages with the content being a string longer than 5 characters were sent:

```
Slack::assertSent(function (SlackMessage $message) {
    return strlen($message->content) >= 100;
}, 2);
```

- Assert that exactly five messages where the content content contains the word 'test' were sent:

```
Slack::assertSent(function (SlackMessage $message) {
    return strpos($message->content, 'test') !== false;
}, 5, true);
```

- Assert that exactly three messages were sent:

```
Slack::assertSentCount(3);
```

- More test helper methods are coming...

Since this package uses `illuminate/notifications` to send notifications you can mock the Notification service instead of the Slack one and use the class `NotificationFake` in your tests. [Take a look](https://laravel.com/docs/5.6/mocking#notification-fake).

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~346 days

Total

3

Last Release

1363d ago

Major Versions

8.0.0 → 9.0.02022-03-02

PHP version history (2 changes)8.0.0PHP &gt;=7.1.3

9.0.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![michaelthuren](https://avatars.githubusercontent.com/u/3227719?v=4)](https://github.com/michaelthuren "michaelthuren (4 commits)")[![mithatcanakgun](https://avatars.githubusercontent.com/u/11079314?v=4)](https://github.com/mithatcanakgun "mithatcanakgun (2 commits)")

---

Tags

laravelslack

### Embed Badge

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

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

###  Alternatives

[laravel/slack-notification-channel

Slack Notification Channel for laravel.

89069.7M111](/packages/laravel-slack-notification-channel)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[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/discord

Laravel notification driver for Discord.

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

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)

PHPackages © 2026

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