sentry/sentry-laravel
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
illuminate/support | v10.48.10 | - | MIT | prod | |
nyholm/psr7 | 1.8.1 | 23.14 kB | MIT | prod dev | |
sentry/sentry | 4.7.0 | - | MIT | prod | |
symfony/psr-http-message-bridge | v7.0.7 | - | MIT | prod |
Sentry/sentry-laravel is a popular composer package that serves as the official Laravel Software Development Kit (SDK) for Sentry. Sentry is an online tool specifically designed to track, record, and resolve software bugs more efficiently. Its goal is to assist developers in creating better software swiftly, boosting productivity and reducing instances of error or application failure.
To use the sentry/sentry-laravel package, start by installing it using composer via the command composer require sentry/sentry-laravel
. Post installation, you must enable the capturing of unhandled exceptions, which are then reported to Sentry. This change should be made in your app/Exceptions/Handler.php
file with the following snippet:
use Sentry\Laravel\Integration;
public function register(): void
{
$this->reportable(function (Throwable $e) {
Integration::captureUnhandledException($e);
});
}
Further, Sentry can be configured as a Laravel Log Channel allowing you to capture info
and debug
logs as well. Afterward, configure the Sentry DSN (Data Source Name) using the command php artisan sentry:publish --dsn=___PUBLIC_DSN___
, which creates a config file (config/sentry.php
) and adds the DSN
to your .env
file. Finally, use it in the code where required:
use function Sentry\captureException;
try {
$this->functionThatMayFail();
} catch (\Throwable $exception) {
captureException($exception);
}
You can find the comprehensive documentation for sentry/sentry-laravel at the official Sentry website. For different Laravel versions and their Sentry implementations, refer to the following guides: