https://github.com/zingimmick/laravel-sentry
Provides sentry context middleware.
https://github.com/zingimmick/laravel-sentry
laravel sentry
Last synced: about 1 year ago
JSON representation
Provides sentry context middleware.
- Host: GitHub
- URL: https://github.com/zingimmick/laravel-sentry
- Owner: zingimmick
- License: mit
- Created: 2020-05-03T15:57:45.000Z (about 6 years ago)
- Default Branch: 3.x
- Last Pushed: 2025-06-11T01:58:02.000Z (about 1 year ago)
- Last Synced: 2025-06-11T02:47:44.760Z (about 1 year ago)
- Topics: laravel, sentry
- Language: PHP
- Homepage:
- Size: 224 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Sentry
### Requirements
- [PHP 8.0+](https://php.net/releases/)
- [Composer](https://getcomposer.org)
- [Laravel 8.0+](https://laravel.com/docs/releases)
Require Laravel Sentry using [Composer](https://getcomposer.org):
```bash
composer require zing/laravel-sentry
```
## Usage
### Add user context
```php
use Zing\LaravelSentry\Middleware\SentryContext;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
protected $middleware = [
// ...
SentryContext::class,
];
// ...
}
```
### Custom user context
```php
use Zing\LaravelSentry\Middleware\SentryContext;
class CustomSentryContext extends SentryContext
{
/**
* @param \Zing\LaravelSentry\Tests\User $user
*
* @return array|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](LICENSE).
