PHPackages                             johnturingan/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. johnturingan/laravel-slack

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

johnturingan/laravel-slack
==========================

Forked Repository

1.3.0(6y ago)0208[1 PRs](https://github.com/johnturingan/laravel-slack/pulls)MITPHPPHP &gt;=7.1.0

Since May 18Pushed 2y agoCompare

[ Source](https://github.com/johnturingan/laravel-slack)[ Packagist](https://packagist.org/packages/johnturingan/laravel-slack)[ RSS](/packages/johnturingan-laravel-slack/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (5)Versions (7)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)

[![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.

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

- And more...

    This package is both under development and underdeveloped. Many features will come. Stay tuned and, please, help us!

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

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 81.3% 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 ~137 days

Recently: every ~169 days

Total

6

Last Release

2230d ago

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

1.1.1PHP &gt;=7.1.0

### Community

Maintainers

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

---

Top Contributors

[![gpressutto5](https://avatars.githubusercontent.com/u/12385501?v=4)](https://github.com/gpressutto5 "gpressutto5 (39 commits)")[![johnturingan](https://avatars.githubusercontent.com/u/9390421?v=4)](https://github.com/johnturingan "johnturingan (6 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)")

---

Tags

laravelslack

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel/slack-notification-channel

Slack Notification Channel for laravel.

89069.7M111](/packages/laravel-slack-notification-channel)[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[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)[nativephp/mobile

NativePHP for Mobile

82724.0k43](/packages/nativephp-mobile)

PHPackages © 2026

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