PHPackages                             xinningsu/thinkphp-sentry - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. xinningsu/thinkphp-sentry

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

xinningsu/thinkphp-sentry
=========================

Sentry integration for ThinkPHP, Sentry整合ThinkPHP。

v1.0.0(9mo ago)01MITPHPPHP &gt;=8.0

Since Aug 15Pushed 9mo agoCompare

[ Source](https://github.com/xinningsu/thinkphp-sentry)[ Packagist](https://packagist.org/packages/xinningsu/thinkphp-sentry)[ Docs](https://github.com/xinningsu/thinkphp-sentry)[ RSS](/packages/xinningsu-thinkphp-sentry/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Sentry integration for ThinkPHP
===============================

[](#sentry-integration-for-thinkphp)

Sentry integration for ThinkPHP, Sentry整合ThinkPHP。

[![MIT licensed](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](./LICENSE)[![Build Status](https://camo.githubusercontent.com/63aa330076612df0df516385a968a52aeabd96f1e37a13f60eeda8d30015b481/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f78696e6e696e6773752f7468696e6b7068702d73656e7472792f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/xinningsu/thinkphp-sentry/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/bc6de6f7b96376625a2d75573ba21cb4ccd0d7a614bd27d5038d1ed2264e91ab/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f78696e6e696e6773752f7468696e6b7068702d73656e7472792f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/xinningsu/thinkphp-sentry/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e68a73b096c9559b7655cc67896723d40d214b4a2ea6653fa3bbe9a2d34cec3f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f78696e6e696e6773752f7468696e6b7068702d73656e7472792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/xinningsu/thinkphp-sentry)[![Code Intelligence Status](https://camo.githubusercontent.com/f76e2ad7869ff34bbfcd626b88007a2e73cb4110fd36d8eeb2ad4c715b6f8f54/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f78696e6e696e6773752f7468696e6b7068702d73656e7472792f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/g/xinningsu/thinkphp-sentry)

安装
==

[](#安装)

```
composer require xinningsu/thinkphp-sentry

```

配置
==

[](#配置)

1. 拷贝这个 [配置文件](./config/sentry.php) 到 `config/sentry.php`, 请务必替换你的 dsn。

    ```
    return [
        'dsn' => 'your_sentry_dsn',
        // ...
    ```

    其他配置项根据自己的需要修改。 更多配置项请参考:
2. 打开 `app/ExceptionHandle.php`，在 `report` 方法里新增一行代码

    ```
    class ExceptionHandle extends Handle
    {
        // ...
        public function report(Throwable $exception): void
        {
            // 使用内置的方式记录异常日志
            parent::report($exception);

            // 在 report 方法里新增下面这行代码
            \Sentry\captureException($exception);
        }
    }
    ```

测试
==

[](#测试)

可以在 `controller` 中加入下面代码

```
\Sentry\Sentry::log('error', new \Exception('test exception'));
```

或直接在 `controller` 中接抛出异常

```
throw new \Exception('test exception');
```

然后看是否能在 Sentry 上看到错误报告。

License
=======

[](#license)

[MIT](./LICENSE)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance58

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

276d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7513c529acb322b54c46bef8011275fe734f9d00944c3f3921cebc21c0cd2ed0?d=identicon)[xinningsu](/maintainers/xinningsu)

---

Top Contributors

[![xinningsu](https://avatars.githubusercontent.com/u/7017728?v=4)](https://github.com/xinningsu "xinningsu (1 commits)")

---

Tags

error-handlingerror-reportingerror-traceserror-trackingsentrysentry-phpthinkphperror-reportingsentryerror-monitoringerror-trackingthinkphp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/xinningsu-thinkphp-sentry/health.svg)

```
[![Health](https://phpackages.com/badges/xinningsu-thinkphp-sentry/health.svg)](https://phpackages.com/packages/xinningsu-thinkphp-sentry)
```

###  Alternatives

[sentry/sentry-laravel

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

1.3k114.3M154](/packages/sentry-sentry-laravel)[sentry/sdk

This is a meta package of sentry/sentry. We recommend using sentry/sentry directly.

328134.8M151](/packages/sentry-sdk)[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1851.5M3](/packages/justbetter-magento2-sentry)[stayallive/wp-sentry

A (unofficial) WordPress plugin to report PHP and JavaScript errors to Sentry.

379197.9k](/packages/stayallive-wp-sentry)[xiaodi/think-whoops

A debug service for ThinkPHP.

413.5k1](/packages/xiaodi-think-whoops)[lordsimal/cakephp-sentry

Sentry plugin for CakePHP

12270.3k](/packages/lordsimal-cakephp-sentry)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
