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

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

gpressutto5/laravel-slack
=========================

Slack notification for Laravel as it should be.

2.4.0(2y ago)290565.1k—0.7%41[4 issues](https://github.com/gpressutto5/laravel-slack/issues)2MITPHPPHP &gt;=7.1.3

Since May 18Pushed 2y ago14 watchersCompare

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

READMEChangelog (8)Dependencies (6)Versions (9)Used By (2)

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

[![Build Status](https://camo.githubusercontent.com/4c6faad8c731668bda3b2dca8902b3a30044a4eb838422ddde7576e63f3e55f6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f6770726573737574746f352f6c61726176656c2d736c61636b2f6d61737465722e7376673f7374796c653d666f722d7468652d6261646765)](https://travis-ci.com/gpressutto5/laravel-slack)[![codecov](https://camo.githubusercontent.com/dd115184da830e06a22c8ad4211e537fccdef5d6144e75200736a06fef266985/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6770726573737574746f352f6c61726176656c2d736c61636b2f6d61737465722e7376673f7374796c653d666f722d7468652d6261646765)](https://codecov.io/gh/gpressutto5/laravel-slack)[![Latest Stable Version](https://camo.githubusercontent.com/ff8e3d64480895eaa1ccc7d749bb4a528d84b4a3ec9bff40082b1a984c1fee41/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6770726573737574746f352f6c61726176656c2d736c61636b2e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/gpressutto5/laravel-slack)[![PHP from Packagist](https://camo.githubusercontent.com/ea3786c628d26cb46ce5aa30b1ba2c9e97bf0f337386217375ea468f21088a56/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6770726573737574746f352f6c61726176656c2d736c61636b2e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/gpressutto5/laravel-slack)[![Laravel Version](https://camo.githubusercontent.com/babfb344bab0e5bfc0d8be8d5b7e7d8064e94b94e0c69eb627929f26ab39ae28/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d253345253344352e352d6f72616e67652e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/gpressutto5/laravel-slack)[![Total Downloads](https://camo.githubusercontent.com/b7899c4af45e2f7739d914ce210695fae989281f300042a04dfca3b815e6e964/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6770726573737574746f352f6c61726176656c2d736c61636b2e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/gpressutto5/laravel-slack)[![License](https://camo.githubusercontent.com/9ced1b621e1cfa8ff584341629c503d2e99e46f38d99864918c6159ea47cc521/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6770726573737574746f352f6c61726176656c2d736c61636b2e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/gpressutto5/laravel-slack)
Based on [illuminate/mail](https://github.com/illuminate/mail)

About Laravel Slack
-------------------

[](#about-laravel-slack)

Slack notification for Laravel as it should be. Easy, fast, simple and **highly testable**. Since it uses On-Demand Notifications, it requires Laravel 5.5 or higher.

> **This library is archived** and no longer maintained. It works as expected, but I don't have time to maintain it anymore. As a last update, I've removed version constraints from the `composer.json` file, so you can use it with any future Laravel versions. Feel free to fork it and use it as you wish.

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

[](#installation)

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

```
composer require gpressutto5/laravel-slack
```

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="Pressutto\LaravelSlack\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!');
```

- Send message by specifying webhook:

```
\Slack::to('#finance')->webhook('https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX')->send('Hey, finance channel! A new order was created just now!');
```

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);
```

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/8.x/mocking#notification-fake).

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity56

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 71.2% 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 ~292 days

Recently: every ~331 days

Total

8

Last Release

874d ago

Major Versions

1.1.0 → 2.0.02020-05-11

PHP version history (2 changes)1.0.0PHP &gt;=7.0.0

2.0.0PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/86cf486f816908377b5669175a4de33fbae3e1905502589473fad78bfe36f0bc?d=identicon)[gpressutto5](/maintainers/gpressutto5)

---

Top Contributors

[![gpressutto5](https://avatars.githubusercontent.com/u/12385501?v=4)](https://github.com/gpressutto5 "gpressutto5 (52 commits)")[![djunehor](https://avatars.githubusercontent.com/u/20708833?v=4)](https://github.com/djunehor "djunehor (10 commits)")[![cfuentessalgado](https://avatars.githubusercontent.com/u/8118712?v=4)](https://github.com/cfuentessalgado "cfuentessalgado (4 commits)")[![ttrig](https://avatars.githubusercontent.com/u/2156132?v=4)](https://github.com/ttrig "ttrig (2 commits)")[![danlake](https://avatars.githubusercontent.com/u/5494442?v=4)](https://github.com/danlake "danlake (2 commits)")[![xabou](https://avatars.githubusercontent.com/u/13403132?v=4)](https://github.com/xabou "xabou (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

laravelphpslacktestablelaravelslack

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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)
