Skip to content

Instantly share code, notes, and snippets.

@pmventura
Last active July 27, 2017 03:00
Show Gist options
  • Save pmventura/e87389da3e09795cbd5ec63073070658 to your computer and use it in GitHub Desktop.
Save pmventura/e87389da3e09795cbd5ec63073070658 to your computer and use it in GitHub Desktop.
Sentry installation on Lumen

Steps:

Step 1: Install the laravel/lumen-framework packaged on your lumen

Step 2: Add in the Sentry Service provider to your bootstrap/app.php

$app->register(Sentry\SentryLaravel\SentryLumenServiceProvider::class);

Step 3: Create a file in your config/sentry.php and this code below

<?php return array( 'dsn' => env('SENTRY_DSN'),

// capture release as git sha
// 'release' => trim(exec('git log --pretty="%h" -n1 HEAD')),

// Capture bindings on SQL queries
'breadcrumbs.sql_bindings' => true,

// Capture default user context
'user_context' => true,

);

Step 4: Add SENTRY_DSN=SENTRY_URL environment variable to your .env file

Step 5: Add in the sentry to your app/Exceptions/Handler.php file. Will look like this:

public function report(Exception $e) { if (app()->bound('sentry') && $this->shouldReport($e)) { app('sentry')->captureException($e); }

parent::report($e); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment