squareboat/sneaker
Composer 安装命令:
composer require squareboat/sneaker
包简介
An easy way to send emails with stack trace whenever an exception occurs on the server for Laravel Applications.
关键字:
README 文档
README
An easy way to send emails with stack trace whenever an exception occurs on the server for Laravel applications.
Install
Install via Composer
For Laravel <= 5.2, please use the v1 branch!
For Laravel 5.2 < version <= 6.x, please use the v5 branch!
$ composer require squareboat/sneaker
Configure Laravel
If you are using laravel 5.5 or higher you should skip this step.
If you are using laravel 5.3 or 5.4, simply add the service provider to your project's config/app.php file:
Service Provider
SquareBoat\Sneaker\SneakerServiceProvider::class,
Add Sneaker's Exception Capturing
Add exception capturing to app/Exceptions/Handler.php:
public function report(Exception $exception) { app('sneaker')->captureException($exception); parent::report($exception); }
Configuration File
Create the Sneaker configuration file with this command:
$ php artisan vendor:publish --provider="SquareBoat\Sneaker\SneakerServiceProvider"
The config file will be published in config/sneaker.php
Following are the configuration attributes used for the Sneaker.
silent
The package comes with 'silent' => true, configuration by default, since you probably don't want error emailing enabled on your development environment. Especially if you've set 'debug' => true,.
'silent' => env('SNEAKER_SILENT', true),
For sending emails when an exception occurs set SNEAKER_SILENT=false in your .env file.
capture
It contains the list of the exception types that should be captured. You can add your exceptions here for which you want to send error emails.
By default, the package has included Symfony\Component\Debug\Exception\FatalErrorException::class.
'capture' => [ Symfony\Component\Debug\Exception\FatalErrorException::class, ],
You can also use '*' in the $capture array which will in turn captures every exception.
'capture' => [ '*' ],
To use this feature you should add the following code in app/Exceptions/Handler.php:
public function report(Exception $exception) { if ($this->shouldReport($exception)) { app('sneaker')->captureException($exception); } parent::report($exception); }
to
This is the list of recipients of error emails.
'to' => [ // 'hello@example.com', ],
ignored_bots
This is the list of bots for which we should NOT send error emails.
'ignored_bots' => [ 'googlebot', // Googlebot 'bingbot', // Microsoft Bingbot 'slurp', // Yahoo! Slurp 'ia_archiver', // Alexa ],
Customize
If you need to customize the subject and body of email, run following command:
$ php artisan vendor:publish --provider="SquareBoat\Sneaker\SneakerServiceProvider"
Note - Don't run this command again if you have run it already.
Now the email's subject and body view are located in the resources/views/vendor/sneaker directory.
We have passed the thrown exception object $exception in the view which you can use to customize the view to fit your needs.
Sneak
Test your integration
To verify that Sneaker is configured correctly and our integration is working, use sneaker:sneak Artisan command:
$ php artisan sneaker:sneak
A SquareBoat\Sneaker\Exceptions\DummyException class will be thrown and captured by Sneaker. The captured exception will appear in your configured email immediately.
Security
If you discover any security related issues, please email akaamitgupta@gmail.com instead of using the issue tracker.
Credits
About SquareBoat
SquareBoat is a startup focused, product development company based in Gurgaon, India. You'll find an overview of all our open source projects on GitHub.
License
The MIT License. Please see License File for more information. Copyright © 2020 SquareBoat
squareboat/sneaker 适用场景与选型建议
squareboat/sneaker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 193.04k 次下载、GitHub Stars 达 220, 最近一次更新时间为 2016 年 09 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「exceptions」 「email」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 squareboat/sneaker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 squareboat/sneaker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 squareboat/sneaker 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
php7ify is a project that brings new php7 classes and exceptions to php 5.x.
The CodenamePHP Platform core that contains basic interfaces, exceptions etc..
A simple package to better handle Exceptions.
Extensible library for building notifications and sending them via different delivery channels.
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
Monitors errors and exceptions and reports them to Rollbar
统计信息
- 总下载量: 193.04k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 226
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-09-23
