crisu83/yii-sentry
Composer 安装命令:
composer require crisu83/yii-sentry
包简介
Sentry for the Yii PHP framework.
关键字:
README 文档
README
Sentry for the Yii PHP framework.
yii-sentry is an extension for Yii that allows for sending data to Sentry. It comes with an application component that allows for centralized access to the Raven client, an error handler that sends errors and exception to Sentry and a log route that sends log messages to Sentry. It has never been this easy to professionally manage your errors.
Features
- Application component for easy access to the Raven client
- Error handler that sends errors to Sentry
- Log route that sends messages to Sentry
Resources
Setup
The easiest way to install this extension is to use Composer by adding the following to your composer.json file:
"require": { "crisu83/yii-sentry": "<replace-with-latest-version>" }
Run the following command in the root directory of your project to install the extension:
php composer.phar install
TIP: Create a path alias to Composer's vendor directory called vendor to ease class mapping to dependencies by adding it to
aliasesin your application configuration.
If you do not want to use Composer, you can download the extension and its dependencies and set everything up manually.
Once you have downloaded the extension add the following to your application configuration:
'components' => array( 'sentry' => array( 'class' => 'vendor.crisu83.yii-sentry.components.SentryClient', 'dns' => '<replace-with-your-sentry-dns>' ), ),
The following configuration parameters are available for the SentryClient:
- dns: (string) dns to use when connecting to Sentry
- environment: (string) name of the active environment
- enabledEnvironments: (array) list of names for environments in which data will be sent to Sentry
- options: (array) options to pass to the Raven client with the following structure:
- logger: (string) name of the logger
- auto_log_stacks: (bool) whether to automatically log stacktraces
- name: (string) name of the server
- site: (string) name of the installation
- tags: (array) key/value pairs that describe the event
- trace: (bool) whether to send stacktraces
- timeout: (int) timeout when connecting to Sentry (in seconds)
- exclude: (array) class names of exceptions to exclude
- shift_vars: (bool) whether to shift variables when creating a backtrace
- processors: (array) list of data processors
Sending errors to Sentry
To enable the SentryErrorHandler add the following to your application configuration:
'components' => array( 'errorHandler' => array( 'class' => 'vendor.crisu83.yii-sentry.components.SentryErrorHandler', ), ),
The following configuration parameters are available for the SentryErrorHandler:
- sentryClientID: (string) component ID for the sentry client
That's it, now errors and exceptions will be sent to Sentry.
Sending log messages to Sentry
To enable the SentryLogRoute add the following to your application configuration:
'components' => array( 'log' => array( 'class' => 'CLogRouter', 'routes' => array( array( 'class' => 'vendor.crisu83.yii-sentry.components.SentryLogRoute', 'levels' => 'error, warning', ), ), ), ),
The following configuration parameters are available for the SentryLogRoute:
- sentryClientID: (string) component ID for the sentry client
That's it, now log messages with levels error and warning will be sent to Sentry.
TIP: Do not log messages with level trace to Sentry because it will slow down your application a lot.
crisu83/yii-sentry 适用场景与选型建议
crisu83/yii-sentry 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.81k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2013 年 10 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「log」 「exception」 「error」 「sentry」 「yii」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 crisu83/yii-sentry 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 crisu83/yii-sentry 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 crisu83/yii-sentry 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
Laravel 5.x.x library for integration Monolog Sentry
PHP Error Handler module that captures and displays all throwable errors in a given format, making debugging easier and more efficient
Pacote simplificado para persistência de logs
Collection of tools to use the full power of the Enyalius framework
Error and Exception override and observers.
统计信息
- 总下载量: 10.81k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 21
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2013-10-12