New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

zing/laravel-sentry

Provides sentry context middleware.
1,051 1
Install
composer require zing/laravel-sentry
Latest Version:3.5.0
PHP:^8.0
Laravel:8 – 13
Older releases:6 · 7
License:MIT
Last Updated:Oct 26, 2026
Links: GitHub  ·  Packagist
Maintainer: zingimmick

Laravel Sentry

Build Status Code Coverage Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality

Requirements

Require Laravel Sentry using Composer:

composer require zing/laravel-sentry

Usage

Add user context

use Zing\LaravelSentry\Middleware\SentryContext;
use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    protected $middleware = [
        // ...
        SentryContext::class,
    ];

    // ...
}

Custom user context

use Zing\LaravelSentry\Middleware\SentryContext;

class CustomSentryContext extends SentryContext
{
    /**
     * @param \Zing\LaravelSentry\Tests\User $user
     *
     * @return array<string, mixed>|mixed[]
     */
    protected function resolveUserContext(string $guard, \Illuminate\Contracts\Auth\Authenticatable $user): array
    {
        if ($guard === 'api') {
            return [
                'id' => $user->getAuthIdentifier(),
                'username' => $user->username,
            ];
        }

        return parent::resolveUserContext($guard, $user);
    }
}

License

Laravel Sentry is an open-sourced software licensed under the MIT license.

Related Packages

rydurham/sentinel

An implementation of the Sentry User Manager for Laravel.

47,568 312
zaengle/envoyer-sentry-release-notifier

A tool to help package release commits for Sentry.

45,855 8
astrogoat/sentry

Monitor your application errors with Sentry

6,724 0
asbiin/laravel-sentry-tunnel

Provides an endpoint to use the `tunnel`-parameter of the Sentry SDK

62,266 2
swisnl/laravel-sentry-extras

Extra debugging information in Sentry, specifically for SWIS

58,528

Version History

Version Released PHP Laravel License
3.5.0 ^8.0 ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0 MIT
3.4.0 ^8.0 ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0 MIT
3.3.0 ^8.0 ^8.0 || ^9.0 || ^10.0 || ^11.0 MIT
3.2.0 ^8.0 ^8.0 || ^9.0 || ^10.0 MIT
3.1.0 ^8.0 ^8.0 || ^9.0 || ^10.0 MIT