boohoodev/zendsentry

A module for integrating Sentry (sentry.io) into Zend Framework 2 projects.

dev-master 2017-04-20 10:33 UTC

This package is not auto-updated.

Last update: 2021-02-06 07:52:06 UTC


README

  1. Require the Sentry Composer package composer require boohoodev/zendsentry
  2. In /config/application.config.php, add Zendsentry into the modules array and ./vendor/boohoodev/zendsentry into the module_paths array, it should look something like this
return [
    // This should be an array of module namespaces used in the application.
    'modules'                 => [
        'Application',
        'Zendsentry',
    ],

    // These are various options for the listeners attached to the ModuleManager
    'module_listener_options' => [

        // This should be an array of paths in which modules reside.
        'module_paths'      => [
            './module',
            './vendor',
            './vendor/boohoodev/zendsentry',
        ],

        // An array of paths from which to glob configuration files after
        // modules are loaded.
        'config_glob_paths' => [
            'config/autoload/{,*.}{global,local}.php',
        ],
    ],
];

Configuration

Basic setup

Get your project DSN from sentry.io under Project Settings > Client Keys (DSN) > DSN.

Note: The project DSN is sensitive and should be treated as an API key or password and should not be version controlled.

The default configuration value for ENABLED is false to prevent spamming sentry until explicitly enabled, so this must be manually enabled to start sending events to sentry. To update these config values add the following block to your /config/autoload/local.php.

'SENTRY' => [
    'DSN'     => 'https://***.***@sentry.io/***',
    'ENABLED' => true,
]

Additional setup

The default environment to tag events with is dev, to override this when deploying to a uat or production environment we can just specify an environment name in the application local config.

'SENTRY' => [
    'DSN'     => 'https://***.***@sentry.io/***',
    'ENABLED' => true,
    'ENVIRONMENT' => 'production',
]