mahmoud-mhamed / laravel-slack-errors-log
This is my package laravel-slack-errors-log
0.0.5
2025-02-18 07:47 UTC
Requires
- php: ^8.1
- illuminate/contracts: ^9.0||^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- laravel/slack-notification-channel: ^2.5.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2025-02-18 07:55:07 UTC
README
This package can quickly send alerts to Slack. You can use this to notify yourself of any error.
Installation
You can install the package via composer:
composer require mahmoud-mhamed/laravel-slack-errors-log
You can publish the config file with:
php artisan vendor:publish --tag="laravel-slack-errors-log-config"
This is the contents of the published config file:
return [ 'log_error_in_local' => env('SLACK_LOG_ERROR_IN_LOCAL', false), 'log_header' => env('SLACK_LOG_HEADER', true), 'header_title' => null, // null = 🚨 env('APP_NAME') Exception Occurred! 'log_content' => env('SLACK_LOG_CONTENT', true), 'content' => null, //null = send error message 'log_url' => env('SLACK_LOG_URL', true), 'log_auth' => env('SLACK_LOG_AUTH', true), 'log_trace' => env('SLACK_LOG_TRACE', false), 'append_message' => null,//string data append to slack log message ];
Create New Webhook URL
to create webhook read doc in https://api.slack.com/messaging/webhooks
Usage
in .env file add LOG_SLACK_WEBHOOK_URL="https://hooks.slack.com/services/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"
in App\Exceptions\Handler.php in register function add
use Mahmoudmhamed\LaravelSlackErrorsLog\LaravelSlackErrorsLog; $this->reportable(function (Throwable $e) { LaravelSlackErrorsLog::sendSlackError($e); });
Credits
License
The MIT License (MIT). Please see License File for more information.