Download the PHP package webparking/laravel-sentry-throttling without Composer

On this page you can find all versions of the php package webparking/laravel-sentry-throttling. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-sentry-throttling

Throttle exceptions being sent to Sentry

Latest Version on Packagist Total Downloads run-tests

Laravel has a built-in mechanism for throttling exceptions, but it can't define throttling rules per reportable. This package throttles exceptions specifically before they are sent to Sentry, so you can keep logging everything locally while avoiding repeated reports of the same exception in Sentry.

Compared to Sentry's own percentage-based sample_rate, this is exception-specific. On top of that, every event that survives a throttle, whether rate-limited or sampled, is tagged so you don't lose sight of how noisy it really was:

Because those tags are indexed by Sentry, you can search and alert on them (e.g. throttled:true, or sort by throttle_occurrences).

Installation

Install via composer:

The package registers itself as sentry.before_send automatically, but only if your project hasn't already configured one, so it never silently clobbers an existing callback. You do not need to touch config/sentry.php unless one of the cases below applies.

If you already have a before_send

Auto-registration backs off when sentry.before_send is already set. Call the throttle from within your own callback to keep both behaviors:

Registering it explicitly

If you prefer to be explicit rather than rely on auto-registration:

Usage

Implement the ThrottlesSentryReports interface in a class of your own. For each exception it returns a Limit (rate-limit), a Lottery (probabilistic sample), or null to let the exception through untouched (Limit::none() does the same). Both a rate-limited survivor and a sampled survivor are tagged with throttled and throttle_occurrences.

Then bind it in the container, typically in App\Providers\AppServiceProvider::register():

The class can live anywhere and be named anything. The package only cares that something is bound to ThrottlesSentryReports. If you're on Laravel 10 or earlier and prefer to co-locate the logic with your existing App\Exceptions\Handler, implement the interface there and bind ThrottlesSentryReports::class to it instead. If nothing is bound, the throttle stays out of the way and every event is sent as usual.

How the throttle bucket is keyed

Each exception is counted and throttled against a bucket. For a Limit, the bucket is whatever you pass to Limit::by(); without it, the bucket defaults to the exception's class, so all instances share one bucket. A Lottery has no key, so it always buckets by exception class.

Migrating from esign/laravel-sentry-throttling

This package is a behavioral superset of esign/laravel-sentry-throttling: the ThrottlesSentryReports interface and its throttleSentry() signature are identical, so your existing throttling rules keep working. On top of that you get the throttled / throttle_occurrences tags and automatic before_send registration.

Migration is a find/replace:

  1. Swap the dependency:

  2. Replace Esign\SentryThrottling with Webparking\SentryThrottling throughout your code (the interface import, the before_send reference, the provider).
  3. Optionally drop your manual before_send line from config/sentry.php, since the package now registers it for you when it isn't already set.

Supported versions

Every combination below is exercised in CI:

PHP Laravel Testbench
8.1 9 7
8.2 10 8
8.3 11 9
8.4 12 10
8.5 13 11

Testing & local development

The full PHP × Laravel matrix runs locally via act, executing the exact CI workflow in Docker:

For day-to-day work there's a Docker workspace pinned to the newest supported combination (PHP 8.5 / Laravel 13):

Prefer running things yourself? composer install && composer test works too.

Thanks

This package is heavily inspired by, and builds directly on the ideas of, esign/laravel-sentry-throttling by Esign. The ThrottlesSentryReports interface, the before_send throttling approach, and the test setup all originate from their excellent work. Thank you. 🙏

License

The MIT License (MIT). Please see the License File for more information.


All versions of laravel-sentry-throttling with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/cache Version ^9.40 || ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^9.40 || ^10.0 || ^11.0 || ^12.0 || ^13.0
sentry/sentry Version ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webparking/laravel-sentry-throttling contains the following files

Loading the files please wait ...