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 12, 2026
Links: GitHub  ·  Packagist
Maintainer: zingimmick

Laravel Sentry

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

coreproc/raven-laravel

A Laravel 5.1 library that easily integrates raven-php to centralize your logs u...

2,888 8
rcrowe/laravel-sentry

Tasty intergration of Laravel & Sentry for sweet reporting of your logs

2,757 15
jenssegers/raven

Sentry (Raven) error monitoring integration for Laravel projects

197,632 90
twineis/raven-php

Sentry (Raven) error monitoring for Laravel and Lumen with send in background vi...

18,108 11

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