Skip to content

Using Spotlight with Laravel

This guide gets Spotlight up and running in Laravel with Sentry SDK.

1. Installation

Install Sentry SDK

Follow the Laravel Getting Started guide to install and configure Sentry SDK for Laravel.

Note that you don’t need a DSN or don’t need to sign up for Sentry to use Spotlight. If you already have Sentry SDK installed, make sure you have a recent version.

Get and Run Spotlight

shell npx @spotlightjs/spotlight

2. Enable Spotlight

Configure Sentry

In your config/sentry.php file, uncomment or add the spotlight configuration:

'spotlight' => env('SENTRY_SPOTLIGHT', false),

Set Environment Variable

Add the SENTRY_SPOTLIGHT environment variable to your .env file:

SENTRY_SPOTLIGHT=true

That’s it! As long as Spotlight is running, and APP_DEBUG is set to true in your Laravel application1, our Laravel integration will automatically inject Spotlight into your UI.

Additional Configuration

If for some reason you do not want Spotlight to inject itself onto the pages, you can disable it by setting SENTRY_SPOTLIGHT=false in your .env file.

If you need to run Spotlight on a different port or domain, you can specify the full URL instead of a boolean value:

SENTRY_SPOTLIGHT=http://localhost:3839/stream

Footnotes

  1. This requirement is to prevent enabling Spotlight accidentally on production environments.