pyaesone17/lapse
Composer 安装命令:
composer require pyaesone17/lapse
包简介
关键字:
README 文档
README
Introducing
Lapse provides a beautiful dashboard to track your errors in production without having to look up log file. Moreover it can notify you via Slack channel and Email alert. And moreover it can notify you via all of the channels from http://laravel-notification-channels.com/.
Lapse behind the scence depend on https://laravel.com/docs/5.6/notifications. It means theoretically Lapses can notify your error via over 30 ways including Slack, Email, Nexmo, Trello, Telegram, Facebook, Discord, Pusher, Twillo, Twitte. But I haven't test agaisnt all of the channels, If you find a bug, please submit an issue. If you want to know more, please kindly check the link.
For old version please see documentation at https://github.com/pyaesone17/lapse/tree/v1
Upgrade Guide
If you are upgrading from version 1.
Please delete config/lapse.php file first.
Install
Install Via Composer
$ composer require pyaesone17/lapse
Publish vendor
$ php artisan vendor:publish
Add slack hook url in config/lapse.php and define channels ( https://api.slack.com/incoming-webhooks )
'channels' => [ 'slack' => 'https://hooks.slack.com/services/......', 'mail' => 'your@mail.com' ], // Currently two notification channels supported // Those are slack and email // But you can use all of the notifications from http://laravel-notification-channels.com/ // See the custom channel of my read me file to explore how to integrate 'via' => ['slack']
$ php artisan vendor:publish
Migrate lapses table
php artisan migrate
Usage
after that register In the report method of App\Exceptions\Handler like this.
use Pyaesone17\Lapse\ErrorNotifiable; .. class Handler extends ExceptionHandler { use ErrorNotifiable; ... public function report(Exception $exception) { if( app()->environment()!='local' ){ // Remove this line if you want lapse to notify in local environment $this->sendNotification($exception); } } ... }
Laravel Lapse's dashboard is inspired by Laravel Horizon. Just like Horizon you can configure authentication to Lapse's dashboard. Add the following to the boot method of your AppServiceProvider. Here you could also check role permision and limit the dasboard.
\Pyaesone17\Lapse\Lapse::auth(function($request) { // return true / false . For e.g. return \Auth::check(); });
To view the dashboard point your browser to /lapse of your app. For e.g. laravel.dev/lapse.
But the app is in local environment, lapse will not even attend to validate auth, It will display it all.
To delete all lapse message via cli , please run
$ php artisan clear:lapse
Custom Notification Channel
you can use all notifications from http://laravel-notification-channels.com/ to integrate with lapse
For example, Telegram
install channel via composer
$ composer require laravel-notification-channels/telegram
configure the config/lapse.php first
use NotificationChannels\Telegram\TelegramChannel; 'channels' => [ 'slack' => 'https://hooks.slack.com/services/......', 'telegram' => 'tele_gram_user_id', //optional ], // Currently two notification channels is supported built in // Those are slack and email 'via' => ['slack', TelegramChannel::class]
register telegram provider
// config/app.php 'providers' => [ ... NotificationChannels\Telegram\TelegramServiceProvider::class, ],
Set credentials
// config/services.php 'telegram-bot-api' => [ 'token' => env('TELEGRAM_BOT_TOKEN', 'YOUR BOT TOKEN HERE') ],
Add the formatter for notificaiton
use NotificationChannels\Telegram\TelegramMessage; use Pyaesone17\Lapse\ErrorNotifiable; .. class Handler extends ExceptionHandler { use ErrorNotifiable; ... public function report(Exception $exception) { if( app()->environment()!='local' ){ // Remove this line if you want lapse to notify in local environment $this->sendNotification($exception, $this->getFormatters()); } } protected function getFormatters() { $formatters = array( 'toTelegram' => function($notifiable) { return TelegramMessage::create() ->content("*HELLO!* \n One of your invoices has been paid!"); } ); return $formatters; } ... }
New Feature
If you want new feature, feel free to submit as an issue
Security
If you discover any security related issues, please email promise@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
pyaesone17/lapse 适用场景与选型建议
pyaesone17/lapse 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.31k 次下载、GitHub Stars 达 174, 最近一次更新时间为 2017 年 10 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「pyaesone17」 「lapse」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pyaesone17/lapse 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pyaesone17/lapse 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pyaesone17/lapse 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 1.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 174
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-13
