aping/laravel-alarm

Installs: 494

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 0

Open Issues: 0

Type:laravel-package

1.0.0 2020-05-29 10:28 UTC

This package is auto-updated.

Last update: 2024-11-10 11:04:04 UTC


README

Architecture

laravel alarm for exception or anything(异常报警或自定义报警通知)

Todo

  • DingTalk Robot(钉钉机器人通知)
  • Mail(邮件通知)
  • Rate Limit(限频)
  • Locale(多语言)
  • Tests

Install

composer

php composer.phar require aping/laravel-alarm

"require": {
    "aping/laravel-alarm": "dev-master"
}

Config

Laravel 5.5+:

Add Service Provider to config/app.php in providers section

Aping\LaravelAlarm\AlarmServiceProvider::class,

Publish config

php artisan vendor:publish --provider="Aping\LaravelAlarm\AlarmServiceProvider"

Start the queue:

php artisan queue:work --queue=laravel-alarm

Finished

Custom Event Alarm

In config/alarm.php

'events' => [
    //system log(日志事件)
    Illuminate\Log\Events\MessageLogged::class => [
        Aping\LaravelAlarm\Alarms\Handlers\DingTalk\MessageLoggedAlarm::class,
    ],
    //custom event(自定义事件)
    event::class => [
        //alarm,must be implemented "Aping\LaravelAlarm\Alarms\Alarm"
        //报警器,必须实现接口Aping\LaravelAlarm\Alarms\Alarm
        Alarms::class,
    ],
],

The implemented(已实现的报警接口)

  • Aping\LaravelAlarm\Alarms\DingTalkAlarm

Tips

DingTalk security mode suggests using signatures.

钉钉机器人安全模式建议用签名(最好不要用关键字)

Screenshot

Screenshot

Last

alarm anything,implemented interface "Aping\LaravelAlarm\Alarms\Alarm"