Download the PHP package elzix/yii2-sentry without Composer
On this page you can find all versions of the php package elzix/yii2-sentry. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-sentry
yii2-sentry
Yii2 integration for Sentry using Sentry PHP SDK v3.
A copy of Olegtsvetkov's Yii2 Sentry v2 package, with minor changes.
Installation
The preferred way to install this package is through composer:
Package doesn't provide any HTTP transport out of the box. To install package with a recommended HTTP client use special metapackage:
Basic Usage
Add "sentry" component to application's config and to bootstrapping, then configure log target as follows:
Don't forget to change DSN to your own.
After this all exceptions (except blacklisted), PHP errors and calls for Yii::error()
and Yii:warning()
will be
logged to Sentry.
It is highly recommended to blacklist all Yii's exceptions for 40x responses, because they are used for handling requests and doesn't indicate about problems of any kind.
Out of the box component provides detailed information about request, such as:
- Request Method
- Request URL (including query string)
- Request Headers
- Request Body
- Resolved route (goes to tags)
- User ID for logged in
- Visitor's IP address
- Visitor's Cookies (with send default PII enabled)
- App environment (taken from
YII_ENV
) - Stack trace for exception
Important nuance about LogTarget
Bundled in Log Target will send only one message to Sentry per request. This message will be based on the log entry with highest severity level. All other entries will go to the extra field "logs" of message
Advanced usage
Sentry client configuration
Component provides out-of-box configuration for Sentry client. It can be overridden and extend using
Component::$sentrySettings
property. Use options from Sentry PHP SDK as-is.
Also, Sentry's ClientBuilder is being created using Yii's container, which allows custom builder injection.
Personally identifying information (PII) handling
By default Sentry provides PII handling on it's side, but it doesn't give full control over PII stripping process. Because of this, Yii2 Sentry package is able to strip PPI from both request headers and request body.
Example of component configuration with a complete list of PII-related settings: