jeremykenedy/slack
Laravel package for Slack integration, letting your app send messages and notifications to Slack channels, often via incoming webhooks. Useful for alerts, error logging, and activity updates from Laravel applications.
Install the package and publish its configuration:
composer require jeremykenedy/slack
php artisan vendor:publish --tag=slack
Open config/slack.php first — that is where the webhook endpoint and any default channel/username/icon settings live. Then add the webhook URL to .env (the package reads it through the config file, so the exact key is whatever config/slack.php expects, typically something like SLACK_WEBHOOK_URL). Grab that URL from Slack under Apps → Incoming Webhooks → Add New Webhook, and treat it as a secret.
Register the facade (usually covered by package discovery, but check config/app.php aliases if you're on an older Laravel) and confirm the wiring with a one-liner:
php artisan tinker
>>> Slack::send('Hello from tinker');
If that lands in your Slack channel, you have everything you need. If not, the two failure points are almost always a cached config (php artisan config:clear) or a webhook pointed at a channel you no longer have access to.
Your first real use case should be the simplest one: notify a channel when something operationally interesting happens — a new order, a failed import, a support form submission.
Wrap sends in your own service. This package is a thin webhook client; don't sprinkle Slack::send() calls through controllers. Put one App\Services\SlackNotifier in front of it so you can swap in laravel/slack-notification-channel or raw Http::post() later without touching call sites.
class SlackNotifier
{
public function alert(string $message, array $context = []): void
{
try {
Slack::send($message.' '.json_encode($context));
} catch (\Throwable $e) {
Log::warning('Slack alert failed', ['error' => $e->getMessage()]);
}
}
}
Push sends off the request path. Slack webhooks are external HTTP calls; a slow or rate-limited endpoint shouldn't add latency to a user's request. Either dispatch a queued job or use dispatchAfterResponse():
dispatch(function () use ($order) {
app(SlackNotifier::class)->alert("New order ##{$order->id} — \${$order->total}");
})->afterResponse();
Feed the exception handler. Hook into App\Exceptions\Handler::report() (or bootstrap/app.php with the new exception API) so unhandled exceptions hit an #errors channel. Gate it on app()->isProduction() so local debugging doesn't spam the team.
Use it for scheduled-task heartbeats. A $schedule->call() or a small artisan command that pings Slack when a nightly job finishes (or doesn't finish) is the highest-value, lowest-effort use of a package like this.
Multiple destinations. If the config supports per-call overrides (webhook/channel), keep named webhooks in config/slack.php — #deployments, #alerts, #sales — and route by key. If it only supports a single global webhook, create separate notifier instances configured from env or read additional webhook URLs from your own config file.
Testing. Stub the underlying HTTP layer with Http::fake() rather than mocking the facade, and assert on the outgoing request payload. Alternatively bind a fake SlackNotifier into the container in TestCase::setUp().
composer.json constraints against your Laravel version; expect to need --ignore-platform-reqs or a repositories fork on Laravel 10/11. Budget time to vendor the ~100 lines of code or replace it with laravel/slack-notification-channel..env, never in config/slack.php committed to git, and rotate it if it leaks. Incoming webhooks are also bound to one channel at creation time — you generally cannot retarget them per message..env on a deployed environment, run php artisan config:cache (or config:clear). A stale cached config is the most common "it works locally" bug with this class of package.429s. Batch or throttle noisy alerts.invalid_payload or channel_not_found message.**bold** renders literally; Slack wants *bold*, and links are <https://example.com|label>. Escape user-supplied content before embedding it in messages, or a stray < will mangle the layout.SLACK_ENABLED=false flag, otherwise every local test run pings the team channel.Notifier interface, bound in a service provider. That interface is your escape hatch when the package stops working on a future Laravel release.How can I help you explore Laravel packages today?