Download the PHP package nikolaynesov/laravel-serene without Composer

On this page you can find all versions of the php package nikolaynesov/laravel-serene. 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-serene

Laravel Serene

Latest Version on Packagist Tests Total Downloads

Graceful, noise-free, and rate-limited exception reporting for Laravel. Stop spamming your error tracking service with duplicate errors and get meaningful insights into how many times errors occurred and how many users were affected.

Features

Installation

Install the package via Composer:

The package will automatically register itself via Laravel's package discovery.

Publish Configuration

Publish the configuration file:

This will create a config/serene.php file.

Environment Variables

Add these to your .env file to configure Serene:

All environment variables are optional. If not set, the defaults shown above will be used.

Using with Bugsnag

If you're using Bugsnag, install the Bugsnag Laravel package:

Then configure Bugsnag according to their documentation.

Set the provider in config/serene.php:

Using with Laravel Logs

To simply log errors to your Laravel logs:

Usage

Integration with Laravel Exception Handler

The recommended way to use Serene is to integrate it with Laravel's exception handler. This automatically reports all exceptions with user context:

This will automatically report all exceptions with the current user's ID, enabling proper user tracking and Bugsnag identification.

Basic Usage

You can also use the Serene facade directly in your code:

Tracking Affected Users

Track which users are affected by an error:

When the error is reported, the context will include:

Important: If using Bugsnag, the first affected user will be set as the primary user for the error report, enabling proper user filtering and search in Bugsnag's Users tab. All affected users remain visible in the metadata.

Enhanced Bugsnag Integration

When using BugsnagReporter, you can provide additional context fields that will enrich the Bugsnag error report:

Recognized fields for Bugsnag:

All fields remain in the error_throttler metadata tab for reference.

Adding Custom Context

Add any additional context to help with debugging:

Error Grouping

Serene provides three ways to control how errors are grouped, from most flexible to automatic. The resolved group key does two things:

  1. Throttling — occurrences sharing a key collapse into a single cooldown window.
  2. Tracker grouping — the key drives the error tracker's native grouping, so all occurrences of a group appear as one error regardless of stacktrace.

Tracker grouping is controlled by the group_by_key config (default true). Set it to false to keep the tracker's default stacktrace-based grouping and have the key affect throttling only. See Tracker Grouping below.

1. Groupable Exceptions (Recommended)

Implement the GroupableException interface on your custom exceptions to define automatic error grouping:

Benefits:

Example with dynamic grouping:

2. Explicit Custom Keys

Override grouping with an explicit key parameter for one-off cases:

When to use: Third-party exceptions you can't modify, or temporary overrides.

3. Auto-Generated Keys

If no interface or explicit key is provided, errors are grouped by exception class + message hash:

Hierarchy: Explicit key > GroupableException > Auto-generated

Tracker Grouping

By default the resolved group key drives the error tracker's native grouping, so getErrorGroup() and explicit keys control how errors group in your tracker's dashboard, not just Serene's throttling — all occurrences of a group collapse into a single error, even when their stacktraces differ.

Each reporter applies this in its own way: the bundled BugsnagReporter sets Bugsnag's grouping hash; a custom reporter for another tracker would map the key to that tracker's equivalent (e.g. Sentry's fingerprint), and a reporter without native grouping simply ignores the flag. The resolved key is always available to every reporter as $context['key'].

This is enabled by default. To opt out and keep the tracker's default stacktrace-based grouping:

Upgrading from < 0.3.0: Earlier versions never applied the key to tracker grouping, so errors grouped by stacktrace. After upgrading, errors reported through Serene will re-group by their key: existing stacktrace-based errors stop receiving events and new key-based errors appear. You may want to mark the superseded errors as fixed. Set group_by_key => false to preserve the old behavior.

How It Works

Rate Limiting Logic

  1. First Occurrence: When an error occurs for the first time, it's immediately reported to your error tracking service
  2. Cooldown Period: A cooldown timer starts (default: 30 minutes)
  3. Subsequent Occurrences: If the same error occurs again during the cooldown:
    • It's not reported (preventing spam)
    • User IDs are collected if provided (up to max_tracked_users limit)
    • Occurrence and throttle counters are incremented
  4. After Cooldown: When the cooldown expires, the next occurrence will be reported with full statistics

Reported Context

When an error is reported, the following context is automatically added:

Debug Logging

Enable debug logging to monitor throttling behavior:

Or in config:

When enabled, Serene logs all activity:

Note: Keep debug logging disabled in production to avoid log clutter. Only enable when investigating throttling issues.

Creating Custom Providers

Simple Custom Provider

You can create your own error reporter by implementing the ErrorReporter interface:

Then configure it in config/serene.php:

Advanced Bugsnag Customization

For advanced Bugsnag integration beyond the built-in fields, extend the BugsnagReporter. Configure your custom reporter:

This approach gives you complete control over the Bugsnag integration while maintaining Serene's rate limiting and user tracking features.

Advanced Configuration

Adjusting Cooldown Period

Change the cooldown period based on your needs:

Per-Environment Configuration

Configure different settings per environment using .env files:

Or dynamically in config config/serene.php

Cache Memory Management

Serene provides two-level protection against cache memory issues:

1. Per-Error User Tracking Cap (max_tracked_users)

Limits the number of users tracked per individual error (default: 1000).

Memory calculation per error:

When user_tracking_capped is true in the error context, it indicates a widespread issue affecting many users.

Adjust for high-traffic applications:

2. Global Error Tracking Cap (max_tracked_errors)

Limits the total number of unique errors tracked simultaneously (default: 1000).

Total memory calculation:

How it works:

For catastrophic scenario protection:

When tracking limit is reached:

Testing

Run the test suite:

Run static analysis:

Requirements

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Credits

License

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


All versions of laravel-serene with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0|^12.0|^13.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 nikolaynesov/laravel-serene contains the following files

Loading the files please wait ...