{"id":15484365,"url":"https://github.com/stasadev/laravel-slack-notifier","last_synced_at":"2025-08-03T10:10:39.099Z","repository":{"id":178075899,"uuid":"661326190","full_name":"stasadev/laravel-slack-notifier","owner":"stasadev","description":"Send exceptions and dump variables to Slack","archived":false,"fork":false,"pushed_at":"2025-08-02T10:53:54.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-02T12:37:09.116Z","etag":null,"topics":["laravel","logging","php","slack"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/stasadev/laravel-slack-notifier","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stasadev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-07-02T13:52:56.000Z","updated_at":"2025-08-02T10:53:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"c80a68a4-d2ed-484c-b239-d5b29170ce9c","html_url":"https://github.com/stasadev/laravel-slack-notifier","commit_stats":null,"previous_names":["stasadev/laravel-slack-notifier"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/stasadev/laravel-slack-notifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stasadev%2Flaravel-slack-notifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stasadev%2Flaravel-slack-notifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stasadev%2Flaravel-slack-notifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stasadev%2Flaravel-slack-notifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stasadev","download_url":"https://codeload.github.com/stasadev/laravel-slack-notifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stasadev%2Flaravel-slack-notifier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268393284,"owners_count":24243302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","logging","php","slack"],"created_at":"2024-10-02T05:40:29.135Z","updated_at":"2025-08-03T10:10:39.075Z","avatar_url":"https://github.com/stasadev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Version on Packagist](https://img.shields.io/packagist/v/stasadev/laravel-slack-notifier.svg?style=flat-square)](https://packagist.org/packages/stasadev/laravel-slack-notifier)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/stasadev/laravel-slack-notifier/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/stasadev/laravel-slack-notifier/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/stasadev/laravel-slack-notifier/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/stasadev/laravel-slack-notifier/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/stasadev/laravel-slack-notifier.svg?style=flat-square)](https://packagist.org/packages/stasadev/laravel-slack-notifier)\n\n# Laravel Slack Notifier\n\nSend exceptions and dump variables to Slack.\n\n```php\nuse Stasadev\\SlackNotifier\\Facades\\SlackNotifier;\n\nSlackNotifier::send(new \\RuntimeException('Test exception'));\nSlackNotifier::send('Test message');\n```\n\n## Installation\n\nInstall the package via composer:\n\n```bash\ncomposer require stasadev/laravel-slack-notifier\n```\n\nAll env variables used by this package (only `LOG_SLACK_WEBHOOK_URL` is required):\n\n```dotenv\nAPP_NAME=Laravel\nLOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/ABC\nLOG_SLACK_CHANNEL=\nLOG_SLACK_EMOJI=:boom:\nLOG_SLACK_CACHE_SECONDS=0\n```\n\nHow to get a webhook URL [in the Slack API docs](https://api.slack.com/messaging/webhooks).\n\nTo temporarily disable all logging, simply comment out `LOG_SLACK_WEBHOOK_URL` or set it to an empty string or `null`.\n\nOptionally publish the [config](./config/slack-notifier.php) file with:\n\n```bash\nphp artisan vendor:publish --tag=\"slack-notifier\"\n```\n\n## Usage\n\nTo send a message to Slack, simply call `SlackNotifier::send()`.\n\n## Report Exception\n\n```php\n// In Laravel 11.x and later\n// bootstrap/app.php\nreturn Application::configure(basePath: dirname(__DIR__))\n    -\u003ewithExceptions(function (Exceptions $exceptions) {\n        $exceptions-\u003ereportable(function (Throwable $e) {\n            \\Stasadev\\SlackNotifier\\Facades\\SlackNotifier::send($e);\n        });\n    })-\u003ecreate();\n\n// In Laravel 8.x, 9.x, 10.x\n// app/Exceptions/Handler.php\npublic function register(): void\n{\n    $this-\u003ereportable(function (Throwable $e) {\n        \\Stasadev\\SlackNotifier\\Facades\\SlackNotifier::send($e);\n    });\n}\n\n// In Laravel 7.x\n// app/Exceptions/Handler.php\npublic function report(Throwable $exception)\n{\n    if ($this-\u003eshouldReport($exception)) {\n        \\Stasadev\\SlackNotifier\\Facades\\SlackNotifier::send($exception);\n    }\n\n    parent::report($exception);\n}\n\n// In Laravel 5.7.x, 5.8.x, 6.x\n// app/Exceptions/Handler.php\npublic function report(Exception $exception)\n{\n    if ($this-\u003eshouldReport($exception)) {\n        \\Stasadev\\SlackNotifier\\Facades\\SlackNotifier::send($exception);\n    }\n\n    parent::report($exception);\n}\n```\n\n## Dump Variable\n\n```php\nuse Stasadev\\SlackNotifier\\Facades\\SlackNotifier;\n\n$variable = 'message';\n// $variable = ['test' =\u003e 'array'];\n// $variable = new stdClass();\n\nSlackNotifier::send($variable);\n```\n\n## Using multiple webhooks\n\nUse an alternative webhook, by specify extra ones in the config file.\n\n```php\n// config/slack-notifier.php\n\n'webhook_urls' =\u003e [\n    'default' =\u003e 'https://hooks.slack.com/services/ABC',\n    'testing' =\u003e 'https://hooks.slack.com/services/DEF',\n],\n```\n\nThe webhook to be used can be chosen using the `to` function.\n\n```php\nuse Stasadev\\SlackNotifier\\Facades\\SlackNotifier;\n\nSlackNotifier::to('testing')-\u003esend('Test message');\n```\n\n### Using a custom webhooks\n\nThe `to` function also supports custom webhook URLs.\n\n```php\nuse Stasadev\\SlackNotifier\\Facades\\SlackNotifier;\n\nSlackNotifier::to('https://custom-url.com')-\u003esend('Test message');\n```\n\n## Sending message to another channel\n\nYou can send a message to a channel (use `LOG_SLACK_CHANNEL`) other than the default one for the webhook, by passing it to the `channel` function.\n\n```php\nuse Stasadev\\SlackNotifier\\Facades\\SlackNotifier;\n\nSlackNotifier::channel('reminders')-\u003esend('Test message');\n```\n\n## Slack bot customizing\n\nUse `username` (use `APP_NAME`) and `emoji` (use `LOG_SLACK_EMOJI`) to make your messages unique, or override them right before sending.\n\n```php\nuse Stasadev\\SlackNotifier\\Facades\\SlackNotifier;\n\nSlackNotifier::username('My Laravel Bot')-\u003eemoji(':tada:')-\u003esend('Test message');\n```\n\n### Formatting\n\nExtend the default `Stasadev\\SlackNotifier\\SlackNotifierFormatter::class` to format the messages however you like. Then simply replace the `formatter` key in the configuration file.\n\n```php\n// config/slack-notifier.php\n\n'formatter' =\u003e App\\Formatters\\CustomSlackNotifierFormatter::class,\n```\n\n### Additional context in the message\n\nInclude additional `context` in a Slack message (use `dont_flash` to exclude sensitive info from `context`). It will be added as an attachment.\n\n### Exception stack trace filtering\n\nStack traces for exceptions in Laravel usually contain many lines, including framework files. Usually, you are only interested in tracking exception details in the application files.\nYou can filter it out with the `dont_trace` config option.\n\n### Caching the same exceptions\n\nSometimes a large group of exceptions is thrown, and you don't want to log each of them because they are the same.\n\nUse `LOG_SLACK_CACHE_SECONDS` (uses Laravel cache under the hood) to suppress output for X seconds, or pass it to the `cacheSeconds` function.\n\n```php\nuse Stasadev\\SlackNotifier\\Facades\\SlackNotifier;\n\nSlackNotifier::cacheSeconds(60)-\u003esend(new \\RuntimeException('Test exception'));\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Credits\n\nInspired by [spatie/laravel-slack-alerts](https://github.com/spatie/laravel-slack-alerts).\n\n- [Stanislav Zhuk](https://github.com/stasadev)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstasadev%2Flaravel-slack-notifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstasadev%2Flaravel-slack-notifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstasadev%2Flaravel-slack-notifier/lists"}