PHPackages                             esign/laravel-sentry-throttling - 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. esign/laravel-sentry-throttling

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

esign/laravel-sentry-throttling
===============================

Throttle exceptions being sent to Sentry

1.1.0(2mo ago)03.9k↓21.7%MITPHPPHP ^8.2CI passing

Since May 14Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/esign/laravel-sentry-throttling)[ Packagist](https://packagist.org/packages/esign/laravel-sentry-throttling)[ Docs](https://github.com/esign/laravel-sentry-throttling)[ RSS](/packages/esign-laravel-sentry-throttling/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (12)Versions (5)Used By (0)

Throttle exceptions being sent to Sentry
========================================

[](#throttle-exceptions-being-sent-to-sentry)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c188dbd5d8c340b20e4242494213a660e4a76129027f6ad2dbf19cc4d27a4473/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f657369676e2f6c61726176656c2d73656e7472792d7468726f74746c696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/esign/laravel-sentry-throttling)[![Total Downloads](https://camo.githubusercontent.com/8435514e4828b25c906d9a1bdbdf30ad078dbef0f1a16e84dca878fdf175f24a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f657369676e2f6c61726176656c2d73656e7472792d7468726f74746c696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/esign/laravel-sentry-throttling)[![GitHub Actions](https://github.com/esign/laravel-sentry-throttling/actions/workflows/main.yml/badge.svg)](https://github.com/esign/laravel-sentry-throttling/actions/workflows/main.yml/badge.svg)

Laravel includes a built-in mechanism for throttling exceptions, but it doesn’t support defining throttling rules for individual reportables. This package adds the ability to throttle exceptions specifically before they are sent to Sentry. It's especially useful if you want to continue logging all exceptions locally while avoiding repeated reports of the same exception being sent to Sentry. While Sentry does offer its own sampling via the sample\_rate setting, that approach is percentage-based and less granular than exception-specific throttling.

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

[](#installation)

You can install the package via composer:

```
composer require esign/laravel-sentry-throttling
```

You must configure the `before_send` option in your `config/sentry.php` file so that Sentry uses the throttling logic. Add the following to your Sentry config:

```
// config/sentry.php
return [
    // ...existing config...
    'before_send' => [\Esign\SentryThrottling\SentryThrottling::class, 'beforeSend'],
];
```

Usage
-----

[](#usage)

### Implementing throttling

[](#implementing-throttling)

#### For Laravel 11+ (slim skeleton)

[](#for-laravel-11-slim-skeleton)

For newer Laravel applications that don't ship with a default exception handler, create a dedicated class that implements the `ThrottlesSentryReports` interface:

```
