PHPackages                             facile-it/sentry-module - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. facile-it/sentry-module

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

facile-it/sentry-module
=======================

This module allows integration of Sentry Client into laminas and mezzio

4.0.0(2y ago)19372.5k↑62%10MITPHPPHP ^7.4 || ^8.0CI failing

Since Apr 12Pushed 2y ago4 watchersCompare

[ Source](https://github.com/facile-it/sentry-module)[ Packagist](https://packagist.org/packages/facile-it/sentry-module)[ Docs](https://github.com/facile-it/sentry-module)[ RSS](/packages/facile-it-sentry-module/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (14)Versions (33)Used By (0)

ZF Sentry Module
================

[](#zf-sentry-module)

This module allows integration with Sentry Client into laminas and mezzio.

Installation
------------

[](#installation)

The only supported way to install this module is trough composer. For composer documentation you can refer to [getcomposer.org](http://getcomposer.org).

Install with implementations of [php-http/async-client-implementation](https://packagist.org/providers/php-http/async-client-implementation) and [psr/http-message-implementation](https://packagist.org/providers/psr/http-message-implementation):

```
php composer.phar require facile-it/sentry-module php-http/curl-client laminas/laminas-diactoros

```

Configuration
-------------

[](#configuration)

### Client

[](#client)

To configure an instance of the client you can do as below:

```
return [
    'sentry' => [
        'disable_module' => false,
        'options' => [
            'dsn' => '',
            // other sentry options
            // https://docs.sentry.io/error-reporting/configuration/?platform=php
        ],
        'javascript' => [
            'inject_script' => false,
            'script' => [
                'src' => 'https://browser.sentry-cdn.com/5.6.3/bundle.min.js',
                'integrity' => 'sha384-/Cqa/8kaWn7emdqIBLk3AkFMAHBk0LObErtMhO+hr52CntkaurEnihPmqYj3uJho',
                'crossorigin' => 'anonymous',
            ],
            'options' => [
                'dsn' => '',
                // other sentry options
                // https://docs.sentry.io/error-reporting/configuration/?platform=php
            ],
        ],
    ],
];
//...
```

Now you can use the client and the Hub by retrieving it from the Service Locator.

```
use Sentry\HubInterface;

$hub = $this->getServiceLocator()->get(HubInterface::class);
```

### Error Handler Listener

[](#error-handler-listener)

This module provides a listener for `MvcEvent::EVENT_DISPATCH_ERROR` and `MvcEvent::EVENT_RENDER_ERROR` events in order to log the exceptions caught in these events.

If you want to use it you should register it in your application module.

#### Example:

[](#example)

```
