What is Laravel Telescope?
Laravel Telescope is an official debugging and monitoring tool for the Laravel framework. It provides a real-time dashboard to monitor requests, exceptions, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, and more. Telescope is an essential companion for local development and fine-tuning production performance.
Local-Only Installation
To keep your production environment clean, install Telescope as a dev dependency:
composer require laravel/telescope --dev
php artisan telescope:install
php artisan migrateService Provider Configuration
Remove App\Providers\TelescopeServiceProvider from bootstrap/providers.php and register providers conditionally in App\Providers\AppServiceProvider.php:
public function register(): void
{
if ($this->app->environment('local') && class_exists(\Laravel\Telescope\TelescopeServiceProvider::class)) {
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
$this->app->register(\App\Providers\TelescopeServiceProvider::class);
}
}Data Pruning (Laravel)
To prevent the telescope_entries table from growing excessively, schedule pruning in routes/console.php:
use Illuminate\Support\Facades\Schedule;
Schedule::command('telescope:prune --hours=48')->daily();Dashboard Authorization
By default, the Telescope dashboard is accessible only in the local environment. For production access, define an authorization gate in App\Providers\TelescopeServiceProvider.php:
protected function gate(): void
{
Gate::define('viewTelescope', function (User $user) {
return in_array($user->email, ['[email protected]']);
});
}Filtering Telescope Data
You can filter entries to prevent logging sensitive or unnecessary data in production:
Telescope::filter(function (IncomingEntry $entry) {
if ($this->app->environment('local')) return true;
return $entry->isReportableException() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
$entry->isSlowQuery() ||
$entry->hasMonitoredTag();
});Watchers
Telescope provides multiple watchers to monitor different aspects of your application:
- CacheWatcher: Monitors cache operations.
- CommandWatcher: Logs Artisan commands.
- DumpWatcher: Records
dump()outputs. - EventWatcher: Monitors dispatched events.
- ExceptionWatcher: Records exceptions.
- GateWatcher: Monitors authorization checks.
- HTTPClientWatcher: Tracks outgoing HTTP requests.
- JobWatcher: Monitors queued jobs.
- LogWatcher: Logs application logs (configurable levels).
- MailWatcher: Previews sent emails.
- ModelWatcher: Tracks Eloquent model events.
- NotificationWatcher: Monitors notifications.
- QueryWatcher: Logs SQL queries, bindings, and slow queries.
- RedisWatcher: Monitors Redis commands (use with caution as it can impact performance).
- RequestWatcher: Logs request/response data.
- ScheduleWatcher: Tracks scheduled tasks.
- ViewWatcher: Records view rendering information.
Related Answers
Still need help?
Talk to our Laravel experts
We've handled GDPR/CCPA compliance for dozens of EU & US Laravel.
