fof / sentry
Flarum integration for Sentry
Fund package maintenance!
Website
Installs: 12 792
Dependents: 1
Suggesters: 0
Security: 0
Stars: 5
Watchers: 5
Forks: 6
Open Issues: 3
Type:flarum-extension
Requires
- flarum/core: ^1.3.1
- sentry/sdk: ^3.1.0
Requires (Dev)
This package is auto-updated.
Last update: 2025-05-02 10:52:37 UTC
README
A Flarum extension. Flarum integration for Sentry.
Installation
Install with composer:
composer require fof/sentry:"*"
Updating
composer update fof/sentry:"*"
Configuration
Configure the extension in the admin panel. You'll need to provide your Sentry DSN to get started.
Customizing Sentry for Developers
This extension provides an extender that allows other extensions to customize Sentry configuration. You can use this to set custom release versions, add tags, and more. All settings are applied to both the PHP backend and JavaScript frontend.
Basic Usage
In your extension's extend.php
file:
use FoF\Sentry\Extend\Sentry; return [ // Other extenders (new Sentry()) ->setRelease('my-app-v1.2.3') ->setEnvironment('production') ->addTag('app_name', 'My Awesome App'), ];
Available Methods
setRelease(string $release)
Set a custom release version for Sentry events (applied to both backend and frontend):
(new Sentry())->setRelease('v2.0.0-beta.1');
setEnvironment(string $environment)
Set a custom environment name (applied to both backend and frontend):
(new Sentry())->setEnvironment('staging');
addTag(string $key, string $value)
Add a custom tag to all Sentry events (applied to both backend and frontend):
(new Sentry()) ->addTag('server_type', 'dedicated') ->addTag('php_version', PHP_VERSION);
addBackendConfig(string $key, $value)
Add a custom configuration option for the PHP SDK:
(new Sentry()) ->addBackendConfig('max_breadcrumbs', 50) ->addBackendConfig('send_default_pii', true);
addFrontendConfig(string $key, $value)
Add a custom configuration option for the JavaScript SDK:
(new Sentry()) ->addFrontendConfig('maxBreadcrumbs', 50) ->addFrontendConfig('debug', true);
Example: Setting Environment Variables
You can use environment variables to configure Sentry:
(new Sentry()) ->setRelease(env('APP_VERSION', 'development')) ->setEnvironment(env('APP_ENV', 'production')) ->addTag('server_id', env('SERVER_ID', 'unknown'));
Links
An extension by FriendsOfFlarum, commissioned by webdeveloper.com.