Laravel Slack Alerts Package


January 28th, 2022

Laravel Slack Alerts Package

Laravel Slack Alerts is a package by Spatie to send a message to slack quickly. While you can set up Slack notifications in Laravel's robust notification system, sometimes all you need is a simple way to trigger a message in various slack channels:

use Spatie\SlackAlerts\Facades\SlackAlert;
SlackAlert::message("{$user->name} just signed up for your Super Awesome SaaS! :party-parrot:");

The above message is sent via a (configurable) job, and you can also configure multiple slack webhook URLs to which you can send messages:

// config
return [
'webhook_urls' => [
'default' => '',
'marketing' => '',
->message("{$user->name} just requested a SaaS demo!");

Messages can also contain markdown and Slack emojis.

If you'd like to learn more about the background behind this package, read A package to send Slack alerts in a Laravel app quickly by Freek Van der Herten.

To get started with this package, check it out the readme and source code on GitHub.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.