Search code examples
phplaravellaravel-5sentry

Disable sentry for laravel on local environment


Is there any way to disable sentry for laravel 5 on local environnement? I have removed the SENTRY_DSN entry from my .env file and it seems to work but I am not sure it's the right way. Should I add some check about env in report function? Or is there any better way? App\Exceptions\Handler looks like this:

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

Solution

  • The suggested way to disable Sentry SDK's is by setting the SENTRY_DSN value to something falsey, so your intuition here is correct.

    https://docs.getsentry.com/hosted/clientdev/#usage-for-end-users