Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

frontend_directory: ./js
backend_directory: .
js_package_manager: npm
js_package_manager: yarn
main_git_branch: master

secrets:
Expand Down
85 changes: 84 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,91 @@ composer require fof/sentry:"*"
composer update fof/sentry:"*"
```

### Links
### 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:

```php
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):

```php
(new Sentry())->setRelease('v2.0.0-beta.1');
```

##### `setEnvironment(string $environment)`

Set a custom environment name (applied to both backend and frontend):

```php
(new Sentry())->setEnvironment('staging');
```

##### `addTag(string $key, string $value)`

Add a custom tag to all Sentry events (applied to both backend and frontend):

```php
(new Sentry())
->addTag('server_type', 'dedicated')
->addTag('php_version', PHP_VERSION);
```

##### `addBackendConfig(string $key, $value)`

Add a custom configuration option for the PHP SDK:

```php
(new Sentry())
->addBackendConfig('max_breadcrumbs', 50)
->addBackendConfig('send_default_pii', true);
```

##### `addFrontendConfig(string $key, $value)`

Add a custom configuration option for the JavaScript SDK:

```php
(new Sentry())
->addFrontendConfig('maxBreadcrumbs', 50)
->addFrontendConfig('debug', true);
```

#### Example: Setting Environment Variables

You can use environment variables to configure Sentry:

```php
(new Sentry())
->setRelease(env('APP_VERSION', 'development'))
->setEnvironment(env('APP_ENV', 'production'))
->addTag('server_id', env('SERVER_ID', 'unknown'));
```

### Links

[![OpenCollective](https://img.shields.io/badge/donate-friendsofflarum-44AEE5?style=for-the-badge&logo=open-collective)](https://opencollective.com/fof/donate) [![GitHub](https://img.shields.io/badge/donate-datitisev-ea4aaa?style=for-the-badge&logo=github)](https://datitisev.me/donate/github)

Expand Down
Loading
Loading