sentry / sentry-laravel
Laravel SDK for Sentry (https://sentry.io)
Fund package maintenance!
sentry.io/pricing
sentry.io
Installs: 74 320 254
Dependents: 138
Suggesters: 3
Security: 0
Stars: 1 261
Watchers: 57
Forks: 188
Open Issues: 17
Requires
- php: ^7.2 | ^8.0
- illuminate/support: ^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0
- nyholm/psr7: ^1.0
- sentry/sentry: ^4.10
- symfony/psr-http-message-bridge: ^1.0 | ^2.0 | ^6.0 | ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.11
- guzzlehttp/guzzle: ^7.2
- laravel/folio: ^1.1
- laravel/framework: ^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0
- livewire/livewire: ^2.0 | ^3.0
- mockery/mockery: ^1.3
- orchestra/testbench: ^4.7 | ^5.1 | ^6.0 | ^7.0 | ^8.0 | ^9.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^8.4 | ^9.3 | ^10.4
- dev-master
- 4.10.1
- 4.10.0
- 4.9.0
- 4.8.0
- 4.7.1
- 4.7.0
- 4.6.1
- 4.6.0
- 4.5.1
- 4.5.0
- 4.4.1
- 4.4.0
- 4.3.1
- 4.3.0
- 4.2.0
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.0
- 3.x-dev
- 3.8.2
- 3.8.1
- 3.8.0
- 3.7.3
- 3.7.2
- 3.7.1
- 3.7.0
- 3.6.1
- 3.6.0
- 3.5.1
- 3.5.0
- 3.4.1
- 3.4.0
- 3.3.3
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.0
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.1
- 3.0.0
- 2.x-dev
- 2.14.2
- 2.14.1
- 2.14.0
- 2.13.0
- 2.12.1
- 2.12.0
- 2.11.1
- 2.11.0
- 2.10.2
- 2.10.1
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.1
- 2.0.0
- 2.0.0-beta1
- 1.x-dev
- 1.9.0
- 1.8.0
- 1.7.1
- 1.7.0
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.0
- 1.4.1
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.2
- 1.0.1
- 1.0.0
- 1.0.0-beta5
- 1.0.0-beta4
- 1.0.0-beta3
- 1.0.0-beta2
- 1.0.0-beta1
- 0.x-dev
- 0.11.0
- 0.10.1
- 0.10.0
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.1
- 0.7.0
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.1
- 0.5.0
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.1
- 0.3.0
- 0.2.0
- 0.1.1
- 0.1.0
- dev-release/4.10.1
- dev-prepare-4-10-1
- dev-docs-link
This package is auto-updated.
Last update: 2024-11-24 11:08:12 UTC
README
Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us Check out our open positions
Official Sentry SDK for Laravel
This is the official Laravel SDK for Sentry.
Getting Started
The installation steps below work on version 11.x of the Laravel framework.
For older Laravel versions and Lumen see:
Install
Install the sentry/sentry-laravel
package:
composer require sentry/sentry-laravel
Enable capturing unhandled exception to report to Sentry by making the following change to your bootstrap/app.php
:
<?php use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; use Sentry\Laravel\Integration; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { // }) ->withExceptions(function (Exceptions $exceptions) { Integration::handles($exceptions); })->create();
Alternatively, you can configure Sentry as a Laravel Log Channel, allowing you to capture
info
anddebug
logs as well.
Configure
Configure the Sentry DSN with this command:
php artisan sentry:publish --dsn=___PUBLIC_DSN___
It creates the config file (config/sentry.php
) and adds the DSN
to your .env
file.
SENTRY_LARAVEL_DSN=___PUBLIC_DSN___
Usage
use function Sentry\captureException; try { $this->functionThatMayFail(); } catch (\Throwable $exception) { captureException($exception); }
To learn more about how to use the SDK refer to our docs.
Laravel Version Compatibility
The Laravel and Lumen versions listed below are all currently supported:
- Laravel
>= 11.x.x
on PHP>= 8.2
is supported starting from4.3.0
- Laravel
>= 10.x.x
on PHP>= 8.1
is supported starting from3.2.0
- Laravel
>= 9.x.x
on PHP>= 8.0
is supported starting from2.11.0
- Laravel
>= 8.x.x
on PHP>= 7.3
is supported starting from1.9.0
- Laravel
>= 7.x.x
on PHP>= 7.2
is supported starting from1.7.0
- Laravel
>= 6.x.x
on PHP>= 7.2
is supported starting from1.2.0
Please note that starting with version >= 2.0.0
we require PHP Version >= 7.2
because we are using our new PHP SDK underneath.
The Laravel versions listed below were supported in previous versions of the Sentry SDK for Laravel:
- Laravel
<= 4.2.x
is supported until0.8.x
- Laravel
<= 5.7.x
on PHP<= 7.0
is supported until0.11.x
- Laravel
>= 5.x.x
on PHP>= 7.1
is supported until2.14.x
Contributing to the SDK
Please refer to CONTRIBUTING.md.
Getting Help/Support
If you need help setting up or configuring the Laravel SDK (or anything else in the Sentry universe) please head over to the Sentry Community on Discord. There is a ton of great people in our Discord community ready to help you!
Resources
License
Licensed under the MIT license, see LICENSE
.