An open API service indexing awesome lists of open source software.

https://github.com/guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、Zulip).
https://github.com/guanguans/laravel-exception-notify

bark chanify discord error exception laravel monitor notification notifier notify pushdeer qq-bot slack telegram

Last synced: 2 months ago
JSON representation

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、Zulip).

Awesome Lists containing this project

README

          

# laravel-exception-notify

usage

> Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

[![tests](https://github.com/guanguans/laravel-exception-notify/actions/workflows/tests.yml/badge.svg)](https://github.com/guanguans/laravel-exception-notify/actions/workflows/tests.yml)
[![php-cs-fixer](https://github.com/guanguans/laravel-exception-notify/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/guanguans/laravel-exception-notify/actions/workflows/php-cs-fixer.yml)
[![codecov](https://codecov.io/gh/guanguans/laravel-exception-notify/branch/main/graph/badge.svg?token=URGFAWS6S4)](https://codecov.io/gh/guanguans/laravel-exception-notify)
[![Latest Stable Version](https://poser.pugx.org/guanguans/laravel-exception-notify/v)](https://packagist.org/packages/guanguans/laravel-exception-notify)
[![GitHub release (with filter)](https://img.shields.io/github/v/release/guanguans/laravel-exception-notify)](https://github.com/guanguans/laravel-exception-notify/releases)
[![Total Downloads](https://poser.pugx.org/guanguans/laravel-exception-notify/downloads)](https://packagist.org/packages/guanguans/laravel-exception-notify)
[![License](https://poser.pugx.org/guanguans/laravel-exception-notify/license)](https://packagist.org/packages/guanguans/laravel-exception-notify)

## Why?

When an exception occurs, we want to be notified immediately, so that we can fix the problem as soon as possible.
This package provides a simple and flexible way to monitor exceptions and report them to the notification channels.

## Related repositories

* [https://github.com/guanguans/notify](https://github.com/guanguans/notify)
* [https://github.com/guanguans/yii-log-target](https://github.com/guanguans/yii-log-target)

## Requirement

* PHP >= 8.2

## Installation

```shell
composer require guanguans/laravel-exception-notify --ansi -v
```

## Configuration

### Publish files(optional)

```shell
php artisan vendor:publish --provider="Guanguans\\LaravelExceptionNotify\\ExceptionNotifyServiceProvider" --ansi -v
```

### Apply for channel authentication information

* [Notify(30+)](https://github.com/guanguans/notify)
* Log
* Mail
* Stack

### Configure channels in the `config/exception-notify.php` and `.env` file

```dotenv
#EXCEPTION_NOTIFY_CHANNEL=stack
EXCEPTION_NOTIFY_STACK_CHANNELS=log,mail,slack
EXCEPTION_NOTIFY_MAIL_TO_ADDRESS=developer1@example.mail,developer2@example.mail
EXCEPTION_NOTIFY_SLACK_WEBHOOK=https://hooks.slack.com/services/TPU9A9/B038KNUC0GY/6pKH3vfa3mjlUPcgLSjzR
```

## Usage

### Test whether exception can be monitored and reported to notification channel

```shell
php artisan exception-notify:test --channel=log --job-connection=sync
php artisan exception-notify:test
php artisan exception-notify:test -v
```

### :camera_flash: Notification examples

:monocle_face: details

| discord | slack | telegram |
|:----------------------------:|:------------------------:|:------------------------------:|
| ![discord](docs/discord.jpg) | ![slack](docs/slack.jpg) | ![telegram](docs/telegram.jpg) |
| lark | mail | weWork |
| ![lark](docs/lark.jpg) | ![mail](docs/mail.jpg) | ![weWork](docs/weWork.jpg) |

### Skip report

bootstrap/app.php

```php
withExceptions(static function (Exceptions $exceptions): void {
$exceptions
// ->dontReportWhen(static fn (Throwable $throwable) => collect([
// \Symfony\Component\HttpKernel\Exception\HttpException::class,
// \Illuminate\Http\Exceptions\HttpResponseException::class,
// ])->contains(static fn (string $exception): bool => $throwable instanceof $exception))
->dontReport([
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Http\Exceptions\HttpResponseException::class,
]);
})->create();
```

Or app/Providers/AppServiceProvider.php

```php
collect([
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Http\Exceptions\HttpResponseException::class,
])->contains(static fn (string $exception): bool => $throwable instanceof $exception));
}
```

### Extend channel

app/Providers/AppServiceProvider.php

```php

## Composer scripts

```shell
composer checks:required
composer php-cs-fixer:fix
composer test
```

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Contributing

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

* [guanguans](https://github.com/guanguans)
* [All Contributors](../../contributors)

## Thanks

[![](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=https://github.com/guanguans)

## License

The MIT License (MIT). Please see [License File](LICENSE) for more information.