phpnomad/sentry-integration
Composer 安装命令:
composer require phpnomad/sentry-integration
包简介
Sentry error monitoring integration for PHPNomad
README 文档
README
Integrates Sentry with PHPNomad's logging. A listener subscribes to ItemLogged events from phpnomad/core, forwards WARNING and above to Sentry as captured events, and records lower-severity entries as breadcrumbs so they appear as context on the next error. Severity mapping, capture rules, and DSN sourcing are all override points.
Installation
composer require phpnomad/sentry-integration
What this provides
- A listener that forwards
ItemLoggedevents to Sentry, with automatic severity mapping from PHPNomad log levels to Sentry severities. - A
SentryCaptureGateinterface with a default implementation that captures WARNING and above. Override it to change what becomes an event versus a breadcrumb. - A
SentryDsnProviderinterface so the host application supplies the DSN from its own configuration source (environment variables, secrets manager, config file).
Requirements
phpnomad/core(provides theItemLoggedevent)phpnomad/eventandphpnomad/loaderfor listener registrationsentry/sentry^4.0- PHP 8.2 or later
Usage
Implement SentryDsnProvider with your application's DSN source, bind it in an initializer, and register SentryInitializer in your loader chain.
use PHPNomad\Loader\Interfaces\HasClassDefinitions; use PHPNomad\Sentry\Interfaces\SentryDsnProvider; class EnvDsnProvider implements SentryDsnProvider { public function getDsn(): string { return $_ENV['SENTRY_DSN'] ?? ''; } } class AppSentryInitializer implements HasClassDefinitions { public function getClassDefinitions(): array { return [EnvDsnProvider::class => SentryDsnProvider::class]; } }
Add SentryInitializer and AppSentryInitializer to your loader. From that point forward, any $logger->error() or $logger->critical() call is forwarded to Sentry without further application changes. If the DSN is empty the hub no-ops, and all Sentry calls are wrapped in try/catch so monitoring never crashes the host app.
Documentation
Framework docs live at phpnomad.com. For Sentry client configuration, see the Sentry PHP SDK documentation.
License
MIT. See LICENSE.
phpnomad/sentry-integration 适用场景与选型建议
phpnomad/sentry-integration 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 335 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 phpnomad/sentry-integration 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phpnomad/sentry-integration 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 335
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-19