sentry/sentry-laravel
Composer 安装命令:
composer require sentry/sentry-laravel
包简介
Laravel SDK for Sentry (https://sentry.io)
关键字:
README 文档
README
Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us Check out our open positions
Official Sentry SDK for Laravel
This is the official Laravel SDK for Sentry.
Getting Started
The installation steps below work on versions 12.x and 11.x of the Laravel framework.
For older Laravel versions and Lumen see:
Install
Install the sentry/sentry-laravel package:
composer require sentry/sentry-laravel
Enable capturing unhandled exception to report to Sentry by making the following change to your bootstrap/app.php:
<?php use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; use Sentry\Laravel\Integration; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { // }) ->withExceptions(function (Exceptions $exceptions) { Integration::handles($exceptions); })->create();
Alternatively, you can configure Sentry as a Laravel Log Channel, allowing you to capture
infoanddebuglogs as well.
Configure
Configure the Sentry DSN with this command:
php artisan sentry:publish --dsn=___PUBLIC_DSN___
It creates the config file (config/sentry.php) and adds the DSN to your .env file.
SENTRY_LARAVEL_DSN=___PUBLIC_DSN___
Usage
use function Sentry\captureException; try { $this->functionThatMayFail(); } catch (\Throwable $exception) { captureException($exception); }
To learn more about how to use the SDK refer to our docs.
Laravel Version Compatibility
The Laravel and Lumen versions listed below are all currently supported:
- Laravel
>= 11.x.xon PHP>= 8.2is supported starting from4.3.0 - Laravel
>= 10.x.xon PHP>= 8.1is supported starting from3.2.0 - Laravel
>= 9.x.xon PHP>= 8.0is supported starting from2.11.0 - Laravel
>= 8.x.xon PHP>= 7.3is supported starting from1.9.0 - Laravel
>= 7.x.xon PHP>= 7.2is supported starting from1.7.0 - Laravel
>= 6.x.xon PHP>= 7.2is supported starting from1.2.0
Please note that starting with version >= 2.0.0 we require PHP Version >= 7.2 because we are using our new PHP SDK underneath.
The Laravel versions listed below were supported in previous versions of the Sentry SDK for Laravel:
- Laravel
<= 4.2.xis supported until0.8.x - Laravel
<= 5.7.xon PHP<= 7.0is supported until0.11.x - Laravel
>= 5.x.xon PHP>= 7.1is supported until2.14.x
Contributing to the SDK
Please refer to CONTRIBUTING.md.
Thanks to all the people who contributed so far!
Getting Help/Support
If you need help setting up or configuring the Laravel SDK (or anything else in the Sentry universe) please head over to the Sentry Community on Discord. There is a ton of great people in our Discord community ready to help you!
Resources
License
Licensed under the MIT license, see LICENSE.
sentry/sentry-laravel 适用场景与选型建议
sentry/sentry-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 129.19M 次下载、GitHub Stars 达 1.35k, 最近一次更新时间为 2016 年 04 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「log」 「logging」 「profiling」 「laravel」 「sentry」 「error-handler」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sentry/sentry-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sentry/sentry-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sentry/sentry-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Quick profiling of your code for Laravel
A Zend Framework module that sets up Monolog for logging in applications.
Excimetry PHP package. Bridge between ext-eximer and open telemetry
Asynchronous Sentry for Symfony - Fire and forget
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
Laravel 5.x.x library for integration Monolog Sentry
统计信息
- 总下载量: 129.19M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1370
- 点击次数: 34
- 依赖项目数: 174
- 推荐数: 10
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-27