定制 vikasrinvi/laravel-bug-watcher 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vikasrinvi/laravel-bug-watcher

Composer 安装命令:

composer require vikasrinvi/laravel-bug-watcher

包简介

to send the mail when error occured

README 文档

README

License

This is package is made for the developer. It sends the error message in email whenever there is any bug in the application and also create a clickup task in the clickup.

Features

  • Send Email with the details of the bug.
  • Create a task in the clickUp with bug report

Future Scope

  • Can be integrated with the AI like chatgpt to which can provide the optimum solution for the bug.
  • We can store the error log and create a UI with some route so that all the previous bug on the system can be tracked

Requirements

  • PHP >= 8.1
  • Laravel >= 9.0

Installation

Run the following command

composer require vikasrinvi/laravel-bug-watcher

After updating composer, add the service provider to the providers array in config/app.php

you can skip adding the provider to config/app.php as it will be auto-discovered

Vikasrinvi\LaravelBugWatcher\LaravelBugWatcherServiceProvider::class,

Then in app/Exceptions/Handler.php replace

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

with

use Vikasrinvi\LaravelBugWatcher\ErrorHandler as ExceptionHandler;

Configuration

To publish the config file

php artisan vendor:publish --provider="Vikasrinvi\LaravelBugWatcher\LaravelBugWatcherServiceProvider" --tag="config"

That will create a config file for you in config/laravel-bug-watcher.php

Default configuration:

'ErrorEmail' => [
      'email' => true,
      'dontEmail' => [],
      'throttle' => true,
      'throttleCacheDriver' => env('CACHE_DRIVER', 'file'),
      'throttleDurationMinutes' => 5,
      'dontThrottle' => [],
      'globalThrottle' => true,
      'globalThrottleLimit' => 20,
      'globalThrottleDurationMinutes' => 30,
      'toEmailAddress' => null,
      'fromEmailAddress' => null,
      'emailSubject' => config('app.name'). " :- Error Occured "
],
 'ClickUp' =>[
     'createTask' => true,
     'token' => env('CLICKUP_ACCESS_TOKEN', null),
     'team_name' => env('CLICKUP_TEAM_NAME', null),
     'folder_name' =>env('CLICKUP_FOlDER_NAME', null),
     'folder_id' => env('CLICKUP_FOlDER_ID', null),
     'list_name' => env('CLICKUP_LIST_NAME', null),
     'list_id' => env('CLICKUP_LIST_ID', null)
 ]

Basic Usage

Basic Config of clickup task

  • createTask (bool) - Enable or disable creating task in the clickup.
  • token (string) - Token from the clickup
  • Team name (string) - Team name is the team in which the project is created we need to get it from the click, it it also the workspace name
  • Folder name (string) - This is the project name in the click up
  • list name - It is task parent of the task under which task will be created in the clickup Important: There should be a Status under the list call 'BACKLOG' and ther should a label create with the name 'bug.

Basic Config of email

  • email (bool) - Enable or disable emailing of errors/exceptions

  • dontEmail (array) - This works exactly like laravel's $dontReport variable documented here: https://laravel.com/docs/10.x/errors]#the-exception-handler under Ignoring Exceptions By Type. Keep in mind also any exceptions under laravel's $dontReport also will not be emailed

  • throttle (bool) - Enable or disable throttling of exception emails. Throttling is only performed if its been determined the exact same exception/error has already been emailed by checking the cache. Errors/Exceptions are determined to be unique by exception class + exception message + exception code

  • throttleCacheDriver (string) - The cache driver to use for throttling, by default it uses CACHE_DRIVER from your env file

  • throttleDurationMinutes (int) - The duration in minutes of the throttle for example if you put 5 and a BadMethodCallException triggers an email if that same exception is thrown again it will not be emailed until 5 minutes have passed

  • dontThrottle (array) - This is the same as dontEmail except provide a list of exceptions you do not wish to throttle ever even if throttling is turned on

  • globalThrottle (bool) - Enable or disable whether you want to globally throttle the number of emails you can receive of all exception types by this application

  • globalThrottleLimit (int) - The the maximum number of emails you want to receive in a given period.

  • throttleDurationMinutes (int) - The duration in minutes of the global throttle for example if you put in 30 and have 10 for your globalThrottleLimit when the first email is sent out a 30 minute timer will commence once you reach the 10 email threshold no more emails will go out for that 30 minute period.

  • toEmailAddress (string|array) - The email(s) to send the exceptions emails to such as the dev team dev@yoursite.com

  • fromEmailAddress (string) - The email address these emails should be sent from such as noreply@yoursite.com.

  • emailSubject (string) - The subject of email, leave NULL to use default Default Subject: Error Occured config('app.name', 'unknown').' ('.config('app.env', 'unknown').')'

Note: the dontReport variable from app/Exceptions/Handler.php file will also not be emailed as it's assumed if they are not important enough to log then they also are not important enough to email

Important: You must fill out a toEmailAddress and fromEmailAddress or you will not receive emails.

Advanced Usage

Changing the view

If you published your view using the command below you will be able to change the look of the exception email by modifying your view in resources/views/vendor/laravel-bug-watcher/emailException.blade.php follow this to publish the view and the you can modify it

php artisan vendor:publish --provider="php artisan vendor:publish --provider="Vikasrinvi\LaravelBugWatcher\LaravelBugWatcherServiceProvider" --tag="views"

Important notes

Make sure you have configured your Mail setting in the env so that Mail can be send

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your-user-string
MAIL_PASSWORD=your-password-string
MAIL_ENCRYPTION=null

vikasrinvi/laravel-bug-watcher 适用场景与选型建议

vikasrinvi/laravel-bug-watcher 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 05 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 vikasrinvi/laravel-bug-watcher 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 vikasrinvi/laravel-bug-watcher 我们能提供哪些服务?
定制开发 / 二次开发

基于 vikasrinvi/laravel-bug-watcher 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-05-15