Search by

patrickfischer / monolog-slack-safe

zero0cool0

A non fatal version of the Monolog SlackWebhookHandler

Package info

github.com/zero0cool0/patrickfischer-monolog-slack-safe

pkg:composer/patrickfischer/monolog-slack-safe

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.4 2026-10-08 07:45 UTC

This package is auto-updated.

Last update: 2026-10-08 07:46:17 UTC


README

A non fatal version of the Monolog SlackWebhookHandler which does not throw on curl error, but uses error_log() as a final fallback.

Installation

Install it with composer:

composer require patrickfischer/safeslackwebhookhandler

Update config/logging.php to use the handler like so:

use PatrickFischer\SafeSlackWebhookHandler;

return [
    // other configuration

    'channels' => [
        // other channels

        'safe_slack' => [
            'driver'  => 'monolog',
            'handler' => SafeSlackWebhookHandler::class,
            'with' => [
                'webhookUrl' => env('LOG_SLACK_WEBHOOK_URL'),
                'channel' => '#absolutebackup',
                'username' => env('LOG_SLACK_USER'),
                'useAttachment' => true,
                'iconEmoji' => env('LOG_SLACK_EMOJI', 'https://api.iconify.design/fluent-emoji-flat/alarm-clock.svg'),
                'useShortAttachment' => false,
                'includeContextAndExtra' => false,
                'level' => env('LOG_LEVEL_SLACK', 'error'),
                'excludeFields' => [],
                'retries' => 1,
                'timeout_ms' => 1000,
            ],
        ],

    ]
];

License

MIT