PHPackages                             netlogix/sentry - 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. netlogix/sentry

ActiveNeos-package[Logging &amp; Monitoring](/categories/logging)

netlogix/sentry
===============

sentry client for Flow &amp; Neos

1.10.2(3mo ago)2272.1k↑79.9%1[1 PRs](https://github.com/netlogix/Netlogix.Sentry/pulls)MITPHPPHP ^8.0CI passing

Since Feb 1Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/netlogix/Netlogix.Sentry)[ Packagist](https://packagist.org/packages/netlogix/sentry)[ RSS](/packages/netlogix-sentry/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (29)Used By (0)

Netlogix.Sentry
===============

[](#netlogixsentry)

About
-----

[](#about)

This package provides a Flow integration for the [sentry.io](https://sentry.io) PHP SDK. Some basic information about the Flow application is added to the sentry Event by default, but you can easily configure and extend this package to fit your needs.

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

[](#installation)

`composer require netlogix/sentry`

Currently the following Flow versions are supported:

- `^7.3`
- `^8.0`
- `^9.0`

Setup
-----

[](#setup)

The sentry DSN Client Key has to be configured. Get it from your project settings (SDK Setup -&gt; Client Keys (DSN)).

```
Netlogix:
  Sentry:
    dsn: 'https://fd5c649e6e4d41dd8ca729b15cc5d1c7@o01392.ingest.sentry.io/123456789'
```

Then simply run `./flow sentry:test` to log an exception to sentry. While this is technically all you **have to** do, you might want to adjust the providers - see below.

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

[](#configuration)

This package allows you to configure which data should be added to the sentry event by changing the providers for each scope. Currently, the available scopes are `environment`, `extra`, `release`, `tags` and `user`.

Providers can be sorted using the [PositionalArraySorter](https://github.com/neos/utility-arrays/blob/master/Classes/PositionalArraySorter.php#L15)position strings. For the scopes `extra`, `tags` and `user`, all data provided will be merged together. The scopes `environment` and `release` only support a **single** value (you can still configure more than one provider, but the last one wins).

```
Netlogix:
  Sentry:
    scope:
      extra: [ ]

      release:
        # If you don't need a specific order, you can simply set the provider to true
        'Netlogix\Sentry\Scope\Release\PathPattern': true

      tags:
        # Numerical order can be used
        'Netlogix\Sentry\Scope\Tags\FlowEnvironment': '10'
        'Your\Custom\TagProvider': '20'

      user:
        'Your\Custom\UserProvider': 'start 1000'
        # If you don't want to add the currently authenticated Flow Account to the Event, simply disable the provider
        'Netlogix\Sentry\Scope\User\FlowAccount': false
```

Environments
------------

[](#environments)

The sentry SDK will search for the environment variable `SENTRY_ENVIRONMENT` and use it's value as the current environment. This is still the default, however you can configure the `Netlogix\Sentry\Scope\Environment\FlowSettings`provider to use a different value:

```
Netlogix:
  Sentry:
    environment:
      setting: '%env:SENTRY_ENVIRONMENT%'
```

Release tracking
----------------

[](#release-tracking)

You can use the `Netlogix\Sentry\Scope\Release\PathPattern` `ReleaseProvider` to extract your current release from the app directory. By default, the configured `pathPattern` is matched against the `FLOW_PATH_ROOT` constant:

```
Netlogix:
  Sentry:

    # Used by Netlogix\Sentry\Scope\Release\PathPattern
    release:
      # Path to use for extraction of release
      pathToMatch: '%FLOW_PATH_ROOT%'

      # Pattern to extract current release from file path
      # This pattern is matched against pathToMatch
      pathPattern: '~/releases/(\d{14})$~'
```

You can also use the `Netlogix\Sentry\Scope\Release\FlowSettings` to set the Release through Flow Configuration (`Netlogix.Sentry.release.setting`, set to `%env:SENTRY_RELEASE%` by default).

Custom Providers
----------------

[](#custom-providers)

For each scope, you can implement your own providers. Each scope requires it's own interface:

- Scope `environment` =&gt; `Netlogix\Sentry\Scope\Environment\EnvironmentProvider`
- Scope `extra` =&gt; `Netlogix\Sentry\Scope\Extra\ExtraProvider`
- Scope `release` =&gt; `Netlogix\Sentry\Scope\Release\ReleaseProvider`
- Scope `tags` =&gt; `Netlogix\Sentry\Scope\Tags\TagProvider`
- Scope `user` =&gt; `Netlogix\Sentry\Scope\User\UserProvider`

Then simply add them to the configuration.

If you need access to the thrown exception, you can check `Netlogix\Sentry\Scope\ScopeProvider::getCurrentThrowable()`:

```
