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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
In the Laravel config, a closure can be used to modify the event or return a completely new one. If you return `null`, the event will be discarded.

```php {filename:config/sentry.php}
'before_send_transaction' => function (\Sentry\Event $transaction): ?\Sentry\Event {
return $transaction;
},
```

<Note>

Learn more in [Closures and Config Caching](/platforms/php/guides/laravel/configuration/laravel-options/#closures-and-config-caching).

</Note>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
In PHP, a closure can be used to modify the event or return a completely new one. If you return `null`, the event will be discarded.

```php
\Sentry\init([
'dsn' => '___PUBLIC_DSN___',
'before_send_transaction' => function (\Sentry\Event $transaction): ?\Sentry\Event {
return $transaction;
},
]);
```
2 changes: 1 addition & 1 deletion src/platforms/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ This function is called with an SDK-specific message or error event object, and

</ConfigKey>

<ConfigKey name="before-send-transaction" supported={["javascript", "node"]}>
<ConfigKey name="before-send-transaction" supported={["javascript", "node", "php"]}>

This function is called with an SDK-specific transaction event object, and can return a modified transaction event object, or `null` to skip reporting the event. This can be used, for instance, for manual PII stripping before sending.

Expand Down