承接 sentry/sentry-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sentry/sentry-laravel

最新稳定版本:4.20.0

Composer 安装命令:

composer require sentry/sentry-laravel

包简介

Laravel SDK for Sentry (https://sentry.io)

README 文档

README

Sentry for Laravel

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

CI Latest Stable Version License Total Downloads Monthly Downloads Discord

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 info and debug logs 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.x on PHP >= 8.2 is supported starting from 4.3.0
  • Laravel >= 10.x.x on PHP >= 8.1 is supported starting from 3.2.0
  • Laravel >= 9.x.x on PHP >= 8.0 is supported starting from 2.11.0
  • Laravel >= 8.x.x on PHP >= 7.3 is supported starting from 1.9.0
  • Laravel >= 7.x.x on PHP >= 7.2 is supported starting from 1.7.0
  • Laravel >= 6.x.x on PHP >= 7.2 is supported starting from 1.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.x is supported until 0.8.x
  • Laravel <= 5.7.x on PHP <= 7.0 is supported until 0.11.x
  • Laravel >= 5.x.x on PHP >= 7.1 is supported until 2.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

  • Documentation
  • Discord
  • Stack Overflow
  • X Follow

License

Licensed under the MIT license, see LICENSE.

统计信息

  • 总下载量: 105.42M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1342
  • 点击次数: 1
  • 依赖项目数: 160
  • 推荐数: 6

GitHub 信息

  • Stars: 1319
  • Watchers: 54
  • Forks: 201
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04