{"id":22547097,"url":"https://github.com/kiwilan/notifier-laravel","last_synced_at":"2025-07-12T00:08:38.762Z","repository":{"id":220475902,"uuid":"751512557","full_name":"kiwilan/notifier-laravel","owner":"kiwilan","description":"Notifier for Laravel is a package to send notifications and monitoring, built for Discord, Slack and mails.","archived":false,"fork":false,"pushed_at":"2025-02-03T06:15:43.000Z","size":399,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-10T00:53:16.369Z","etag":null,"topics":["discord","laravel","logging","mail","notification","slack","webhook"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/kiwilan/notifier-laravel","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/kiwilan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"Kiwilan"}},"created_at":"2024-02-01T18:54:05.000Z","updated_at":"2025-02-03T06:15:40.000Z","dependencies_parsed_at":"2024-03-16T10:53:02.401Z","dependency_job_id":"ce06e68c-6059-4391-921a-4877242dc36f","html_url":"https://github.com/kiwilan/notifier-laravel","commit_stats":null,"previous_names":["kiwilan/notifier-laravel"],"tags_count":19,"template":false,"template_full_name":"spatie/package-skeleton-laravel","purl":"pkg:github/kiwilan/notifier-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwilan%2Fnotifier-laravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwilan%2Fnotifier-laravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwilan%2Fnotifier-laravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwilan%2Fnotifier-laravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiwilan","download_url":"https://codeload.github.com/kiwilan/notifier-laravel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwilan%2Fnotifier-laravel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264916028,"owners_count":23682957,"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","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":["discord","laravel","logging","mail","notification","slack","webhook"],"created_at":"2024-12-07T15:10:07.312Z","updated_at":"2025-07-12T00:08:38.734Z","avatar_url":"https://github.com/kiwilan.png","language":"PHP","funding_links":["https://github.com/sponsors/Kiwilan"],"categories":[],"sub_categories":[],"readme":"# **Notifier for Laravel**\n\n![Banner with british letter box picture in background and Notifier for Laravel title](https://raw.githubusercontent.com/kiwilan/notifier-laravel/main/docs/banner.jpg)\n\n[![php][php-version-src]][php-version-href]\n[![laravel][laravel-src]][laravel-href]\n\n[![version][version-src]][version-href]\n[![downloads][downloads-src]][downloads-href]\n[![license][license-src]][license-href]\n[![tests][tests-src]][tests-href]\n[![codecov][codecov-src]][codecov-href]\n\nNotifier for Laravel is a package to send notifications (with `Notifier`) and monitoring (with `Journal`), built for Discord, Slack and mails.\n\nBased on [`kiwilan/php-notifier`](https://github.com/kiwilan/php-notifier).\n\n\u003e [!IMPORTANT]\n\u003e This package does not support push notifications or SMS (if you interested, a PR is welcome) on [`kiwilan/php-notifier`](https://github.com/kiwilan/php-notifier).\n\n## About\n\nLaravel offers a built-in [Notification](https://laravel.com/docs/10.x/notifications) and [Laravel Logging](https://laravel.com/docs/10.x/logging) systems, this package is an alternative to these systems.\n\n`Notifier` allows to send notifications without link to a user model and advanced and `Journal` is based on `Log` facade. `Journal` can write logs send notifications and write logs in the database with `filament/notifications` package (not included and not required).\n\nWhen native Laravel notifications are for users, this package is designed for developers to help for debugging and monitoring, but you can use it for users too.\n\nThis package offer a support for Discord and Slack webhooks, but Slack has only basic support (without legacy API support), for more, you can use [`laravel/slack-notification-channel`](https://github.com/laravel/slack-notification-channel). To avoid dependencies, this package doesn't use it.\n\n-   [Discord webhooks](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks): support message and rich embeds.\n-   [Slack webhooks](https://api.slack.com/messaging/webhooks): support message, attachments.\n-   Mail: support message and attachments with [`symfony/mailer`](https://symfony.com/doc/current/mailer.html).\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require kiwilan/notifier-laravel\n```\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"notifier-config\"\n```\n\n\u003e [!NOTE]\n\u003e The configuration file is totally optional, if you have multiple webhooks, you can create your own configs to send notifications.\n\nThis is the contents of the published config file:\n\n```php\nreturn [\n    // Default notifier client to send HTTP request, can be `stream`, `curl` or `guzzle`.\n    // `guzzle` is not included in this package, you need to install it manually.\n    'client' =\u003e env('NOTIFIER_CLIENT', 'stream'),\n\n    'discord' =\u003e [\n        // Default Discord webhook URL.\n        'webhook' =\u003e env('NOTIFIER_DISCORD_WEBHOOK', null),\n        // Default Discord username.\n        'username' =\u003e env('NOTIFIER_DISCORD_USERNAME', null),\n        // Default Discord avatar URL.\n        'avatar_url' =\u003e env('NOTIFIER_DISCORD_AVATAR_URL', null),\n    ],\n\n    'mail' =\u003e [\n        // Use Laravel mailer instead package from `.env` file.\n        'laravel_override' =\u003e env('NOTIFIER_MAIL_LARAVEL_OVERRIDE', false),\n        // Set default subject for mail.\n        'subject' =\u003e env('NOTIFIER_MAIL_SUBJECT', 'Notifier'),\n        // Set default mailer from `.env` file.\n        'mailer' =\u003e env('NOTIFIER_MAIL_MAILER', 'smtp'),\n        'host' =\u003e env('NOTIFIER_MAIL_HOST', 'mailpit'),\n        'port' =\u003e env('NOTIFIER_MAIL_PORT', 1025),\n        'username' =\u003e env('NOTIFIER_MAIL_USERNAME', null),\n        'password' =\u003e env('NOTIFIER_MAIL_PASSWORD', null),\n        'encryption' =\u003e env('NOTIFIER_MAIL_ENCRYPTION', 'tls'),\n        'from_address' =\u003e env('NOTIFIER_MAIL_FROM_ADDRESS', null),\n        'from_name' =\u003e env('NOTIFIER_MAIL_FROM_NAME', null),\n        'to_address' =\u003e env('NOTIFIER_MAIL_TO_ADDRESS', null),\n        'to_name' =\u003e env('NOTIFIER_MAIL_TO_NAME', null),\n    ],\n\n    'slack' =\u003e [\n        // Default Slack webhook URL.\n        'webhook' =\u003e env('NOTIFIER_SLACK_WEBHOOK', null),\n    ],\n\n    'http' =\u003e [\n        // Default HTTP URL to send request.\n        'url' =\u003e env('NOTIFIER_HTTP_URL', null),\n    ],\n\n    // This feature use `filament/notifications` package, not included in this package.\n    'to_database' =\u003e [\n        // Default user model for notification.\n        'model' =\u003e env('NOTIFIER_TO_DATABASE_USER', 'App\\Models\\User'),\n        // Recipients ID for notification.\n        'recipients_id' =\u003e explode(',', env('NOTIFIER_TO_DATABASE_RECIPIENTS_ID', '')),\n    ],\n\n    'journal' =\u003e [\n        // Write logs for debugging when notifications are sent.\n        'debug' =\u003e env('NOTIFIER_JOURNAL_DEBUG', false),\n        // Write error logs with `error_log` function, in addition to Laravel log.\n        'use_error_log' =\u003e env('NOTIFIER_JOURNAL_USE_ERROR_LOG', true),\n    ],\n];\n```\n\n## Usage\n\n### Journal\n\nJournal is a utility class for [Laravel Logging](https://laravel.com/docs/10.x/logging).\n\n```php\nuse Kiwilan\\Notifier\\Facades\\Journal;\n\nJournal::debug('Hello, Journal!');\nJournal::info('Hello, Journal!');\nJournal::warning('Hello, Journal!');\nJournal::error('Hello, Journal!');\n```\n\n#### To database\n\nYou can use Journal to log in the database with `filament/notifications` package (you have to install it).\n\nThis method will search `App\\Models\\User::class` and get all users with `canAccessPanel()` allowed, by default all users with access will be notified.\n\n```php\nuse Kiwilan\\Notifier\\Facades\\Journal;\n\nJournal::info('Hello, Journal!')\n  -\u003etoDatabase();\n```\n\n#### To notifier\n\nYou can use Journal to send a notification with `discord`, `mail` or `slack` (you have to set the config file).\n\n```php\nuse Kiwilan\\Notifier\\Facades\\Journal;\n\nJournal::info('Hello, Journal!')\n  -\u003etoNotifier('discord');\n```\n\n#### Handler\n\nYou can use Journal as a handler for [Laravel Exceptions](https://laravel.com/docs/10.x/errors).\n\n-   `toDatabase` is a boolean to log the exception in the database with `filament/notifications` package (you have to install it).\n-   `toNotifier` is a string to send a notification with `discord`, `mail` or `slack` (you have to set the config file).\n\n```php\n\u003c?php\n\nnamespace App\\Exceptions;\n\nuse Kiwilan\\Notifier\\Facades\\Journal;\nuse Illuminate\\Foundation\\Exceptions\\Handler as ExceptionHandler;\nuse Throwable;\n\nclass Handler extends ExceptionHandler\n{\n  public function register(): void\n  {\n    $this-\u003ereportable(function (Throwable $e) {\n      Journal::handler($e, toDatabase: true, toNotifier: 'mail');\n    });\n  }\n}\n```\n\n### Notifier\n\nNotifier is an alternative to [Laravel Notifications](https://laravel.com/docs/10.x/notifications).\n\n\u003e [!NOTE]\n\u003e If `notifier.journal.debug` is `true`, `debug` level logs will be written for sending and sent notifications.\n\u003e In all cases, `error` level logs will be written for sending errors.\n\nFor HTTP client, you can configure `notifier.client` in the config file with `stream`, `curl` or `guzzle` and override it with second parameter for Discord, Slack and HTTP.\n\n#### Discord\n\nDefault webhook URL, username and avatar URL can be set in the config file.\n\n```php\nuse Kiwilan\\Notifier\\Facades\\Notifier;\n\n$notifier = Notifier::discord()\n  -\u003eusername('Laravel')\n  -\u003eavatarUrl('https://laravel.com/img/favicon/favicon-32x32.png')\n  -\u003emessage('Hello, Discord!');\n\n$notifier-\u003esend();\n```\n\nYou can pass a custom webhook URL:\n\n```php\nuse Kiwilan\\Notifier\\Facades\\Notifier;\n\n$notifier = Notifier::discord('https://discord.com/api/webhooks/1234567890/ABCDEFGHIJKLMN0123456789');\n```\n\n#### Mail\n\nDefault `mailer`, `host`, `port`, `username`, `password`, `encryption`, `from address`, `from name`, `to address` and `to name` can be set in the config file.\n\nYou can use `NOTIFIER_MAIL_LARAVEL_OVERRIDE` to use Laravel mailer instead of package mailer.\n\n```php\nuse Kiwilan\\Notifier\\Facades\\Notifier;\n\n$notifier = Notifier::mail()\n  -\u003esubject('Hello, Mail!')\n  -\u003emessage('Hello, Mail!');\n\n$notifier-\u003esend();\n```\n\nYou can pass a custom mailer:\n\n```php\nuse Kiwilan\\Notifier\\Facades\\Notifier;\n\n$notifier = Notifier::mail('smtp')\n  -\u003efrom('hello@example.com', 'Hello')\n  -\u003eto('to@example.com', 'To')\n  -\u003esubject('Hello, Mail!')\n  -\u003emessage('Hello, Mail!')\n  -\u003emailer('smtp')\n  -\u003ehost('mailpit')\n  -\u003eport(1025)\n  -\u003eusername(null)\n  -\u003epassword(null)\n  -\u003eencryption('tls');\n```\n\n#### Slack\n\nDefault webhook URL can be set in the config file.\n\n```php\nuse Kiwilan\\Notifier\\Facades\\Notifier;\n\n$notifier = Notifier::slack()\n  -\u003emessage('Hello, Slack!');\n\n$notifier-\u003esend();\n```\n\nYou can pass a custom webhook URL:\n\n```php\nuse Kiwilan\\Notifier\\Facades\\Notifier;\n\n$notifier = Notifier::slack('https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX');\n```\n\n#### HTTP\n\nYou can use Notifier to send a request with `http` method. URL can be null if you set it in the config file with `notifier.http.url`.\n\n```php\nuse Kiwilan\\Notifier\\Facades\\Notifier;\n\n$notifier = Notifier::http('https://example.com')\n  -\u003emethod('POST')\n  -\u003eheaders([\n    'Content-Type' =\u003e 'application/json',\n  ])\n  -\u003ebody([\n    'hello' =\u003e 'world',\n  ])\n  -\u003esend();\n```\n\n#### Command\n\nYou can use Notifier as a command to send a notification with `discord`, `mail` or `slack`.\n\nTwo options are available:\n\n-   `-t` or `--type` to set the type of notification, default is `mail`.\n-   `-w` or `--webhook` to set the webhook URL (only for `discord` and `slack`). If not set, the default webhook URL from the config file will be used.\n\n```bash\nphp artisan notifier -t=discord -w=https://discord.com/api/webhooks/1234567890/ABCDEFGHIJKLMN0123456789 \"Hello, Discord!\"\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n-   [Ewilan Rivière](https://github.com/ewilan-riviere)\n-   [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[\u003cimg src=\"https://user-images.githubusercontent.com/48261459/201463225-0a5a084e-df15-4b11-b1d2-40fafd3555cf.svg\" height=\"120rem\" width=\"100%\" /\u003e](https://github.com/kiwilan)\n\n[version-src]: https://img.shields.io/packagist/v/kiwilan/notifier-laravel.svg?style=flat-square\u0026colorA=18181B\u0026colorB=777BB4\n[version-href]: https://packagist.org/packages/kiwilan/notifier-laravel\n[php-version-src]: https://img.shields.io/static/v1?style=flat-square\u0026label=PHP\u0026message=v8.1\u0026color=777BB4\u0026logo=php\u0026logoColor=ffffff\u0026labelColor=18181b\n[php-version-href]: https://www.php.net/\n[downloads-src]: https://img.shields.io/packagist/dt/kiwilan/notifier-laravel.svg?style=flat-square\u0026colorA=18181B\u0026colorB=777BB4\n[downloads-href]: https://packagist.org/packages/kiwilan/notifier-laravel\n[license-src]: https://img.shields.io/github/license/kiwilan/notifier-laravel.svg?style=flat-square\u0026colorA=18181B\u0026colorB=777BB4\n[license-href]: https://github.com/kiwilan/notifier-laravel/blob/main/README.md\n[tests-src]: https://img.shields.io/github/actions/workflow/status/kiwilan/notifier-laravel/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square\u0026colorA=18181B\n[tests-href]: https://github.com/kiwilan/notifier-laravel/actions/workflows/run-tests.yml\n[codecov-src]: https://codecov.io/gh/kiwilan/notifier-laravel/branch/main/graph/badge.svg?token=1py1fk6vwc\n[codecov-href]: https://codecov.io/gh/kiwilan/notifier-laravel\n[laravel-src]: https://img.shields.io/static/v1?label=Laravel\u0026message=v10-11\u0026style=flat-square\u0026colorA=18181B\u0026colorB=FF2D20\n[laravel-href]: https://laravel.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiwilan%2Fnotifier-laravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiwilan%2Fnotifier-laravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiwilan%2Fnotifier-laravel/lists"}