PHPackages                             codegym/laravel-slack-output - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. codegym/laravel-slack-output

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

codegym/laravel-slack-output
============================

Sends a message to Slack when something goes wrong with your Laravel application.

v1.2.1(8y ago)01.2kMITPHPPHP &gt;=5.5.9

Since Apr 3Pushed 8y agoCompare

[ Source](https://github.com/duongdung2911/laravel-package-slack-output)[ Packagist](https://packagist.org/packages/codegym/laravel-slack-output)[ RSS](/packages/codegym-laravel-slack-output/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (4)Versions (5)Used By (0)

Laravel SlackOutput
===================

[](#laravel-slackoutput)

Sends messages to [Slack](https://slack.com) with your [Laravel](https://laravel.com) application.

This package provides:

- Post Command
    ------------

    [](#post-command)

    Send message to slack with a Laravel command.
- Stats Command
    -------------

    [](#stats-command)

    Send stats about your Laravel app with this customizable command.
- Exceptions handler
    ------------------

    [](#exceptions-handler)

    Output to Slack useful information about exceptions when they occurred.
- Failed jobs handler
    -------------------

    [](#failed-jobs-handler)

    Get alerted when a job failed.
- Scheduled commands reporting
    ----------------------------

    [](#scheduled-commands-reporting)

    Keep an eye on the result of your scheduled commands.

Requirements
============

[](#requirements)

- Laravel 5.1 or greater
- PHP 5.5.9 or greater

Installation
============

[](#installation)

You can install the package using the [Composer](https://getcomposer.org/) package manager. You can install it by running this command in your project root:

```
composer require codegym/laravel-slack-output
```

You need to include the service provider and the facade in your Laravel app.

Add the service provider to the `providers` array in `config/app.php`:

```
'providers' => [
  ...
  CodeGym\SlackOutput\ServiceProvider::class,
],
```

and then add the facade to your `aliases` array:

```
'aliases' => [
  ...
  'SlackOutput' => CodeGym\SlackOutput\Facade\SlackOutput::class,
],
```

Publish the configuration file with:

```
php artisan vendor:publish --provider="CodeGym\SlackOutput\ServiceProvider"
```

You need to add the webhook URL to the configuration file in order for the package to post to Slack. [Create an incoming webhook](https://my.slack.com/services/new/incoming-webhook) on your Slack account. Copy the webhook url and open `config/slack-output.php` and set the webhook url to `endpoint`.

If `null` is set for any, the package will fall back on the default settings set by the webhook.

Usage
=====

[](#usage)

Post Command
------------

[](#post-command-1)

The command `slack:post` posts message to Slack. It can take as arguments:

- `message`: the message to send
- `to`: the channel or person to post to
- `attach`: the attachment payload

You can find information about the attach argument here:

You can call it by the running the command:

```
php artisan slack:post "Hello, I'm a bot" #channel
```

You can also call it in your Laravel app:

```
Artisan::call('slack:post', [
  'to' => "#api-output",
  'attach' => $someAttachment,
  'message' => "Hello, I'm a bot"
]);
```

Note the `Artisan::call`, the command will be executed in background and will not block the current request.

Stats command
-------------

[](#stats-command-1)

The command `slack:stats` send useful stats about your app to slack.

You need to configure this command by setting in `config/slack-output.php` the Eloquent classes and dates you prefer.

You can add constraints to the classes to limit the number of counted data.

```
'classes' => [
	  \App\Models\User::class => [
		  'is_active' => true //optional constraint
	  ]
],
```

The dates array is the form `'name of the date' => Carbon::instance()`. Like:

```
'dates' => [
	'yesterday' => \Carbon\Carbon::yesterday(),
	'last week' => \Carbon\Carbon::today()->subWeek(1)
]
```

To schedule this command every day, simple add to `app/Console/Kernel.php`:

```
protected function schedule(Schedule $schedule)
{
  $schedule->command('slack:stats')->daily()
}
```

Exceptions handler
------------------

[](#exceptions-handler-1)

To report useful exception to Slack, open `app/Exceptions/Handler.php`, and transform it like:

```
use CodeGym\SlackOutput\Facade\SlackOutput;

...

public function report(Exception $e)
{
  if ($this->shouldReport($e)) {
    SlackOutput::exception($e);
  }

  parent::report($e);
}
```

This will only reports exceptions that are not in the `$dontReport` array in the same file.

Failed jobs handler
-------------------

[](#failed-jobs-handler-1)

To report failed jobs to Slack, open `app/Providers/AppServiceProvider.php`, and transform it like:

```
use CodeGym\SlackOutput\Facade\SlackOutput;

...

public function boot()
{
  Queue::failing(function (JobFailed $job) {
    SlackOutput::jobFailed($job);
  });
}
```

Scheduled commands reporting
----------------------------

[](#scheduled-commands-reporting-1)

To report the output of scheduled commands to Slack, open `app/Console/Kernel.php`, and transform it like:

```
use CodeGym\SlackOutput\Facade\SlackOutput;

...

protected function schedule(Schedule $schedule)
{
  SlackOutput::scheduledCommand(
    $schedule->command('db:backup-auto')->daily()
  );
}
```

Contributing
============

[](#contributing)

If you have problems, found a bug or have a feature suggestion, please add an issue on GitHub. Pull requests are also welcomed!

License
=======

[](#license)

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

28

—

LowBetter than 51% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

4

Last Release

3051d ago

### Community

Maintainers

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

---

Top Contributors

[![duongdung2911](https://avatars.githubusercontent.com/u/28588453?v=4)](https://github.com/duongdung2911 "duongdung2911 (8 commits)")

---

Tags

exceptionslackcommandjobslaravel 5.4

### Embed Badge

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

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k99.8M349](/packages/laravel-horizon)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M295](/packages/laravel-ai)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M185](/packages/spatie-laravel-health)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

731189.9k16](/packages/tallstackui-tallstackui)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k1](/packages/mike-bronner-laravel-model-caching)[nicolasmahe/laravel-slack-output

Sends a message to Slack when something goes wrong with your Laravel application.

2943.0k](/packages/nicolasmahe-laravel-slack-output)

PHPackages © 2026

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