Lumen
Lumen is supported via a native package, sentry-laravel.
Sentry supports Lumen 5+.
Install the sentry/sentry-laravel
package:
Copied
composer require sentry/sentry-laravel
Register Sentry in bootstrap/app.php
:
bootstrap/app.php
Copied
$app->register('Sentry\Laravel\ServiceProvider');
# Sentry must be registered before routes are included
require __DIR__ . '/../app/Http/routes.php';
Add Sentry reporting to app/Exceptions/Handler.php
:
app/Exceptions/Handler.php
Copied
public function report(Exception $exception)
{
if (app()->bound('sentry') && $this->shouldReport($exception)) {
app('sentry')->captureException($exception);
}
parent::report($exception);
}
Create the Sentry configuration file (config/sentry.php
):
config/sentry.php
Copied
<?php
return array(
'dsn' => 'https://examplePublicKey@o0.ingest.sentry.io/0',
// capture release as git sha
// 'release' => trim(exec('git log --pretty="%h" -n1 HEAD')),
);
You can edit this page on GitHub.
- Package:
- composer:sentry/sentry-laravel
- Version:
- 2.3.1
- Repository:
- https://github.com/getsentry/sentry-laravel