PHPackages                             spatie/laravel-slack-slash-command - 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. spatie/laravel-slack-slash-command

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

spatie/laravel-slack-slash-command
==================================

Make a Laravel app respond to a slash command from Slack

1.13.0(2mo ago)254601.2k↓15.8%482MITPHPPHP ^7.3|^8.0CI failing

Since Jul 21Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/spatie/laravel-slack-slash-command)[ Packagist](https://packagist.org/packages/spatie/laravel-slack-slash-command)[ Docs](https://github.com/spatie/laravel-slack-slash-command)[ RSS](/packages/spatie-laravel-slack-slash-command/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (34)Used By (2)

 [   ![Logo for laravel-slack-slash-command](https://camo.githubusercontent.com/3144c1e037b5ae28ffa6739a5786ef35d3f6b17872525b52b908b97da3a427e7/68747470733a2f2f7370617469652e62652f7061636b616765732f6865616465722f6c61726176656c2d736c61636b2d736c6173682d636f6d6d616e642f68746d6c2f6c696768742e77656270)  ](https://spatie.be/open-source?utm_source=github&utm_medium=banner&utm_campaign=laravel-slack-slash-command)Making a Laravel app respond to Slack commands
==============================================

[](#making-a-laravel-app-respond-to-slack-commands)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e9ff3eb8215339b244d6344b45b428a5b4286fe219aa9494e258db5a531c44d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d736c61636b2d736c6173682d636f6d6d616e642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-slack-slash-command)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/2d2ddbc2b70e4204c453b394835624eecf12ea07653f759ad5560b529978dd3d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370617469652f6c61726176656c2d736c61636b2d736c6173682d636f6d6d616e642f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/spatie/laravel-slack-slash-command)[![Quality Score](https://camo.githubusercontent.com/96f0ac82b63354291293f4d873ef0c87f225a364cde4b954934747eac8fef958/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370617469652f6c61726176656c2d736c61636b2d736c6173682d636f6d6d616e642e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/spatie/laravel-slack-slash-command)[![Total Downloads](https://camo.githubusercontent.com/d781badaa154af89f3736665680cb03c3f1db33ef886a429ba8e79905e7e04e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d736c61636b2d736c6173682d636f6d6d616e642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-slack-slash-command)

This package makes it easy to make your Laravel app respond to [Slack's Slash commands](https://api.slack.com/slash-commands).

Once you've setup your Slash command over at Slack and installed this package into a Laravel app you can create handlers that can handle a slash command. Here's an example of such a handler that will send a response back to slack.

```
namespace App\SlashCommandHandlers;

use App\SlashCommand\BaseHandler;
use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;

class CatchAll extends BaseHandler
{
    /**
     * If this function returns true, the handle method will get called.
     *
     * @param \Spatie\SlashCommand\Request $request
     *
     * @return bool
     */
    public function canHandle(Request $request): bool
    {
        return true;
    }

    /**
     * Handle the given request. Remember that Slack expects a response
     * within three seconds after the slash command was issued. If
     * there is more time needed, dispatch a job.
     *
     * @param \Spatie\SlashCommand\Request $request
     *
     * @return \Spatie\SlashCommand\Response
     */
    public function handle(Request $request): Response
    {
        return $this->respondToSlack("You have typed this text: `{$request->text}`");
    }
}
```

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/b02e4c41201e319ebeda5c38401943977d4d497149f94de69de72582fddae66e/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d736c61636b2d736c6173682d636f6d6d616e642e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-slack-slash-command)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require spatie/laravel-slack-slash-command
```

This service provider must be installed.

```
// config/app.php
'providers' => [
    ...
    Spatie\SlashCommand\SlashCommandServiceProvider::class,
];
```

You can publish the config-file with:

```
php artisan vendor:publish --provider="Spatie\SlashCommand\SlashCommandServiceProvider"
```

This is the contents of the published file:

```
return [

    /*
     * At the integration settings over at Slack you can configure the url to which the
     * slack commands are posted. Specify the path component of that url here.
     *
     * For `http://example.com/slack` you would put `slack` here.
     */
    'url' => 'slack',

    /*
     * The token generated by Slack with which to verify if a incoming slash command request is valid.
     */
    'token' => env('SLACK_SLASH_COMMAND_VERIFICATION_TOKEN'),

    /*
     * The signing_secret generated by Slack with which to verify if a incoming slash command request is valid.
     */
    'signing_secret' => env('SLACK_SIGNING_SECRET'),

    /*
     * Verify requests from slack with signing_secret signature
     */
    'verify_with_signing' => false,

    /*
     * The handlers that will process the slash command. We'll call handlers from top to bottom
     * until the first one whose `canHandle` method returns true.
     */
    'handlers' => [
        //add your own handlers here

        //this handler will display instructions on how to use the various commands.
        Spatie\SlashCommand\Handlers\Help::class,

        //this handler will respond with a `Could not handle command` message.
        Spatie\SlashCommand\Handlers\CatchAll::class,
    ],
];
```

Change `verify_with_signing` parameter to verify requests from slack by `signing_secret`:

```
// config/laravel-slack-slash-command.php
'verify_with_signing' => true
```

Documentation
-------------

[](#documentation)

You'll find the documentation on .

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the media library? Feel free to [create an issue on GitHub](https://github.com/spatie/laravel-slack-slash-command/issues), we'll try to address it as soon as possible.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

### Security

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Postcardware
------------

[](#postcardware)

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards [on our company website](https://spatie.be/en/opensource/postcards).

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

The message and attachment functionalities were heavily inspired on [Regan McEntyre's Slack package](https://github.com/maknz/slack).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance83

Actively maintained with recent releases

Popularity57

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 70.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 ~113 days

Recently: every ~191 days

Total

32

Last Release

85d ago

Major Versions

0.0.1 → 1.0.02016-07-21

PHP version history (4 changes)0.0.1PHP ^7.0

1.8.0PHP ^7.2

1.11.0PHP ^7.3

1.11.1PHP ^7.3|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (140 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (8 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (6 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (4 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (4 commits)")[![jorenvh](https://avatars.githubusercontent.com/u/8791625?v=4)](https://github.com/jorenvh "jorenvh (4 commits)")[![jimirobaer](https://avatars.githubusercontent.com/u/8984769?v=4)](https://github.com/jimirobaer "jimirobaer (3 commits)")[![akoepcke](https://avatars.githubusercontent.com/u/5311185?v=4)](https://github.com/akoepcke "akoepcke (3 commits)")[![hskrasek](https://avatars.githubusercontent.com/u/787487?v=4)](https://github.com/hskrasek "hskrasek (2 commits)")[![khandurdyiev](https://avatars.githubusercontent.com/u/11858259?v=4)](https://github.com/khandurdyiev "khandurdyiev (2 commits)")[![lode](https://avatars.githubusercontent.com/u/511245?v=4)](https://github.com/lode "lode (2 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (2 commits)")[![nckg](https://avatars.githubusercontent.com/u/360602?v=4)](https://github.com/nckg "nckg (1 commits)")[![ntzm](https://avatars.githubusercontent.com/u/3888578?v=4)](https://github.com/ntzm "ntzm (1 commits)")[![osbre](https://avatars.githubusercontent.com/u/23292709?v=4)](https://github.com/osbre "osbre (1 commits)")[![roelti](https://avatars.githubusercontent.com/u/8746960?v=4)](https://github.com/roelti "roelti (1 commits)")[![schwindy](https://avatars.githubusercontent.com/u/11136250?v=4)](https://github.com/schwindy "schwindy (1 commits)")[![svenluijten](https://avatars.githubusercontent.com/u/11269635?v=4)](https://github.com/svenluijten "svenluijten (1 commits)")[![tonning](https://avatars.githubusercontent.com/u/7304678?v=4)](https://github.com/tonning "tonning (1 commits)")[![CapturedMomentum](https://avatars.githubusercontent.com/u/12801429?v=4)](https://github.com/CapturedMomentum "CapturedMomentum (1 commits)")

---

Tags

laravelnotificationsphprobotsslackslash-commandsspatielaravel-slack

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/spatie-laravel-slack-slash-command/health.svg)

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

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[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/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)

PHPackages © 2026

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