kiwilan/sentinel-laravel
最新稳定版本:0.0.33
Composer 安装命令:
composer require kiwilan/sentinel-laravel
包简介
PHP package for Laravel to send errors to Sentinel.
README 文档
README
PHP package for Laravel to send errors to Sentinel.
Note
Sentinel is an open-source error tracking tool.
Installation
You can install the package via composer:
composer require kiwilan/sentinel-laravel
You can publish the config file with:
php artisan vendor:publish --tag="sentinel-config"
This is the contents of the published config file:
return [ /** * If you want to disable Sentinel, set `SENTINEL_ENABLED` to `false`. */ 'enabled' => env('SENTINEL_ENABLED', true), /** * Sentinel host where your application is registered. */ 'host' => env('SENTINEL_HOST', 'http://app.sentinel.test'), /** * Token is used to authenticate your application with Sentinel. */ 'token' => env('SENTINEL_TOKEN'), /** * If you want to throw Sentinel errors for debug, set `SENTINEL_DEBUG` to `true`. * WARNING: do not use it on production. */ 'debug' => env('SENTINEL_DEBUG', false), ];
Usage
Automatic
Just execute the sentinel:install Artisan command. It will automatically install the package and configure it for you.
php artisan sentinel:install
Manual
In app/Exceptions/Handler.php
<?php namespace App\Exceptions; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Throwable; class Handler extends ExceptionHandler { /** * Register the exception handling callbacks for the application. */ public function register(): void { $this->reportable(function (Throwable $e) { \Kiwilan\Sentinel\Facades\Sentinel::register($e); }); } }
If you want to debug your installation, you can set true to throwErrors: \Kiwilan\Sentinel\Facades\Sentinel::register($e, throwErrors: true).
Warning
Do not use throwErrors in production, if Sentinel instance is not available, your application will crash.
Verify your installation
Use the sentinel:test Artisan command to verify your installation.
php artisan sentinel:test
You can verify your installation by throwing an exception from a route or controller.
For example, in routes/web.php:
Route::get('/debug-sentinel', function () { throw new \Exception('Sentinel error!'); });
Testing
cp .env.example .env
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
- Ewilan Rivière
spatieforspatie/laravel-package-tools- All Contributors
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 62
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-19