mezonix/sf-sentry-plugin

Symfony 1.x plugin for Sentry

Installs: 1 432

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 2

Open Issues: 0

Type:symfony1-plugin

1.1.2 2020-05-29 20:16 UTC

This package is auto-updated.

Last update: 2024-10-29 05:17:04 UTC


README

Packagist Downloads Latest Stable Version License

Enable remote logging to Sentry into Symfony1 applications.

Listens to events:

  • Fatal errors (syntax error, out of memory)
  • Warnings (undefined variable, headers sent, deprecated)
  • Exceptions

Support for sending custom events:

  • Exceptions
  • Messages with any error level

Requirements

  • PHP ≥ 5.3
  • Symfony ≥ 1.4
  • Sentry instance

Installation

With composer

composer require mezonix/sf-sentry-plugin

Add to your project configuration:

# config/ProjectConfiguration.php

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    $this->enablePlugins(array(
      // ...
      'sfSentryPlugin',
    ));
  }
}

Configure the Sentry client. The DSN can be found in the Sentry interface.

# config/sentry.yml

all:
  client:
    dsn: http://public@sentry.example.com:9000/[PROJECT_ID]
    options:
      release: ~
      exclude:
        - sfStopException
      auto_log_stacks: true
  • dsn - Sentry connection URL.
  • options/release - Release version or tag name.
  • options/exclude - List of exception classes that are ignored.
  • options/auto_log_stacks - Generates a backtrace. See debug-backtrace.

Usage

Sentry

// send debug message
Sentry::sendDebug('Debug message text');

// send information message
Sentry::sendInfo('Information message text');

// send warning message
Sentry::sendWarn('Warning message text');

// send error message
Sentry::sendError('Error message text');

// send error message with variables
Sentry::sendError('Error message text', array('foo' => 'bar'));

// send exception
Sentry::sendException(new Exception('Exception message'));

// send exception with variables
Sentry::sendException(new Exception('Exception message'), array('foo' => 'bar'));

License

FOSSA Status