PHPackages                             justrau/laravel-pretty-slack-logs - 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. justrau/laravel-pretty-slack-logs

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

justrau/laravel-pretty-slack-logs
=================================

Pretty Slack log channel for Laravel — formats errors as rich Block Kit messages with request context, git/host info, app-frame Location, Caused-by chains, and JSON context.

v0.1.1(1mo ago)11MITPHPPHP ^8.2CI passing

Since May 6Pushed 1mo agoCompare

[ Source](https://github.com/justrau/laravel-pretty-slack-logs)[ Packagist](https://packagist.org/packages/justrau/laravel-pretty-slack-logs)[ Docs](https://github.com/justrau/laravel-pretty-slack-logs)[ RSS](/packages/justrau-laravel-pretty-slack-logs/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (9)Versions (3)Used By (0)

laravel-pretty-slack-logs
=========================

[](#laravel-pretty-slack-logs)

[![Tests](https://github.com/justrau/laravel-pretty-slack-logs/actions/workflows/tests.yml/badge.svg)](https://github.com/justrau/laravel-pretty-slack-logs/actions/workflows/tests.yml)[![Latest Version](https://camo.githubusercontent.com/c3cbaf5d3167151aefc5e0578e228110ca7aef76d0460ac4cd500b21a2d61d31/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a7573747261752f6c61726176656c2d7072657474792d736c61636b2d6c6f67732e737667)](https://packagist.org/packages/justrau/laravel-pretty-slack-logs)[![Total Downloads](https://camo.githubusercontent.com/3e50b6d3e5a13009f7a3e1fac0c2eca1ce58a3b76dba937ba4f0de290c9936c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a7573747261752f6c61726176656c2d7072657474792d736c61636b2d6c6f67732e737667)](https://packagist.org/packages/justrau/laravel-pretty-slack-logs)[![License](https://camo.githubusercontent.com/a20126187d621ae419aebad5c23f599baf95808c20785b8203b7875616ce94d2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a7573747261752f6c61726176656c2d7072657474792d736c61636b2d6c6f67732e737667)](LICENSE)

A drop-in Slack log channel for Laravel that turns the noisy default error dump into a structured, color-coded Block Kit message — with HTTP request context, git/host info, app-frame Location, Caused-by chains, and JSON context.

Screenshots
-----------

[](#screenshots)

[![Exception with a Caused-by chain](docs/screenshots/exception-with-cause.png)](docs/screenshots/exception-with-cause.png)

*A domain-level error wrapping a vendor-side cause — env header, request context, app-frame Location, stack trace, and the chained `Caused by`.*

[![Critical alert with rich JSON context](docs/screenshots/critical-with-context.png)](docs/screenshots/critical-with-context.png)

*`Log::critical(...)` with a structured context array — rendered as pretty-printed JSON.*

[![Database query exception](docs/screenshots/query-exception.png)](docs/screenshots/query-exception.png)

*`Illuminate\Database\QueryException` with the SQL embedded in the message and a `Caused by PDOException` in the trace below (cropped).*

What you get
------------

[](#what-you-get)

Every error sent to Slack includes:

- **Color sidebar** per log level (warning / error / critical / emergency)
- **Header** with severity emoji, level, and exception class (or message)
- **Environment line**: `local · MyApp · a1b2c3d (main) · host: web-1`
- **Message** in a code block
- **Location** — the first non-vendor stack frame with `file:line — Class::method()`, plus a separate "Thrown at" line if the throw site differs
- **Request context** for HTTP requests: method, URL, route name, IP, authenticated user, user-agent
- **Console context** for artisan commands: full command line
- **Stack (app frames)** — top frames excluding `vendor/` and entry points
- **Caused by** chain — each previous exception rendered with the same Location-style format
- **Context** — any `Log::error('msg', [...context])` array, pretty-printed JSON
- **Footer** with timestamp

Long fields are automatically truncated with a `… (truncated)` marker so messages never blow Slack's block size limits.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11, 12, or 13
- A Slack [Incoming Webhook URL](https://api.slack.com/messaging/webhooks)

Install
-------

[](#install)

```
composer require justrau/laravel-pretty-slack-logs
```

Configure
---------

[](#configure)

Add a channel to `config/logging.php`:

```
use JustRau\PrettySlackLogs\Channel;

return [
    'channels' => [

        'stack' => [
            'driver' => 'stack',
            'channels' => ['daily', 'pretty-slack'],
            'ignore_exceptions' => false,
        ],

        'pretty-slack' => [
            'driver' => 'custom',
            'via' => Channel::class,
            'url' => env('LOG_SLACK_WEBHOOK_URL'),
            'level' => env('LOG_SLACK_LEVEL', 'error'),
        ],

    ],
];
```

Then add to `.env`:

```
LOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/XXX/YYY/ZZZ
LOG_SLACK_LEVEL=error

```

That's it. Errors logged at or above `LOG_SLACK_LEVEL` will be posted to Slack.

Usage
-----

[](#usage)

Anything that hits the configured channel gets formatted automatically:

```
// Throws → caught by Laravel's exception handler → reported to the stack channel
throw new RuntimeException('Boom');

// Reported manually
report(new DomainException('handled but worth flagging'));

// Direct logger calls with context
Log::error('Failed to send notification', [
    'user_id' => 42,
    'channel' => 'email',
    'attempt' => 3,
]);

// Direct to this channel
Log::channel('pretty-slack')->critical('Payment processor unreachable', [
    'provider' => 'stripe',
    'amount' => 12345,
]);
```

Configuration options
---------------------

[](#configuration-options)

KeyDefaultDescription`url`*none*Slack webhook URL. If empty, the handler silently no-ops.`level``error`Minimum log level to send (debug, info, notice, warning, error, critical, alert, emergency).`name``pretty-slack`The Monolog channel name attached to each record.License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance93

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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

2

Last Release

34d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/19192635543f037be503da92a6b1e4b9f9c3e3fb4f2786fe25a24e6b3905df78?d=identicon)[justrau](/maintainers/justrau)

---

Top Contributors

[![justrau](https://avatars.githubusercontent.com/u/10882793?v=4)](https://github.com/justrau "justrau (5 commits)")

---

Tags

laravelloggingslackerrorsexceptionsmonologblock-kit

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/justrau-laravel-pretty-slack-logs/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[bugsnag/bugsnag-laravel

Official Bugsnag notifier for Laravel applications.

90335.7M37](/packages/bugsnag-bugsnag-laravel)[illuminate/log

The Illuminate Log package.

6425.0M597](/packages/illuminate-log)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[naoray/laravel-github-monolog

Log driver to store logs as github issues

10822.5k](/packages/naoray-laravel-github-monolog)[honeybadger-io/honeybadger-laravel

Honeybadger Laravel integration

431.3M](/packages/honeybadger-io-honeybadger-laravel)

PHPackages © 2026

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