amaristany/yii2-sentry

Yii2 Sentry integration as an extension (component + log target).

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:yii2-extension

pkg:composer/amaristany/yii2-sentry

v1.0.4 2025-12-08 02:42 UTC

This package is auto-updated.

Last update: 2025-12-08 03:04:38 UTC


README

A Yii2 extension that integrates Sentry error tracking and logging into your Yii2 application.

Description

This extension provides seamless integration of Sentry SDK with Yii2, allowing you to capture and report errors, exceptions, and performance data to Sentry. It includes a component for initialization and a custom queue transport for handling events asynchronously.

Installation

Install the extension via Composer:

composer require amaristany/yii2-sentry

Configuration

Configure the Sentry component in your application config:

// config/main.php
return [
    // ...
    'components' => [
        'sentry' => [
            'class' => 'Amaristany\Sentry\SentryComponent',
            'dsn' => 'https://your-dsn@sentry.io/project-id',
            'queueId' => 'queue', // optional, defaults to 'queue'
        ],
    ],
];

Usage

Once configured, the extension will automatically capture errors and exceptions in your Yii2 application. You can also manually capture events:

use Sentry;

Sentry\captureException(new Exception('Something went wrong'));
Sentry\captureMessage('Something happened');

For more advanced usage, refer to the Sentry PHP SDK documentation.

Requirements

  • PHP >= 8.1.0
  • Yii2 ~2.0.0
  • Sentry SDK ^4.0
  • Guzzle HTTP ^7.0

License

This extension is licensed under the MIT License. See the LICENSE file for details.