Skip to content
Expressive Delegator for Sentry
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
README.md
composer.json
phpcs.xml

README.md

SentryDelegator

This is an expressive delegator for the service Sentry utilizing Sentry's latest PHP SDK. The only required config is your Sentry project DSN. You can optionally add an environment, which will automatically be registered in your expressive application. Below is an example config.

return [
  'sentry' => [
    'dsn' => '[project dsn]',
    'environment' => '[environment]',
  ],
];

Installation

You can install SentryDelegator using Composer:

$ composer require tigerman55/sentry-delegator

Configuration

To bind your configuration to Sentry, you'll need to invoke the following somewhere early in your application. One option, is to put this in index.php right after the container initialization.

(new ConfigureSentry())($container->get('config'))

Advanced Usage

Sentry context is supported with this delegator. To add context, simply add the following in the appropriate middleware:

Sentry\configureScope(function (Scope $scope) use ($context) : void {
    $scope->setUser([
        'email'    => $context['email'],
        'username' => $context['username'],
    ]);
});
You can’t perform that action at this time.