Laravel 12 Telescope: The Ultimate Debugging Companion for Laravel Developers

Author

Kritim Yantra

Apr 22, 2025

Laravel 12 Telescope: The Ultimate Debugging Companion for Laravel Developers

If you're a Laravel developer looking for a powerful tool to debug and monitor your applications, Laravel Telescope is your best friend. Telescope provides real-time insights into requests, database queries, jobs, exceptions, and much more—all in an elegant dashboard.

In this blog, we’ll explore:
What Laravel 12 Telescope is and why it’s useful
How to install and configure Telescope
Key features and how to use them
Best practices for local and production use


What is Laravel 12 Telescope?

Laravel Telescope is an open-source debugging assistant designed specifically for Laravel applications. It gives developers a real-time view of:

  • HTTP requests (routes, responses, headers)
  • Database queries (including slow queries)
  • Queued jobs & failed jobs
  • Exceptions & logs
  • Cache operations, scheduled tasks, emails, and more

Telescope is perfect for local development, but with proper configuration, it can also be used in production for debugging issues .


How to Install Laravel Telescope

Installing Telescope is simple. Follow these steps:

1. Install via Composer

Run this command in your Laravel 12 project:

composer require laravel/telescope

For local-only development, add --dev flag:

composer require laravel/telescope --dev

2. Publish Assets & Run Migrations

php artisan telescope:install  
php artisan migrate  

This creates the necessary database tables for storing Telescope logs.

3. Access the Telescope Dashboard

Visit /telescope in your browser. You’ll see a detailed dashboard with all monitored activities.


Key Features of Laravel 12 Telescope

1. Requests Monitoring

  • See all incoming HTTP requests (method, URI, status code, response time).
  • Inspect headers, input data, and session info .

2. Database Query Debugging

  • Lists all executed queries with execution time.
  • Identifies slow queries (configurable threshold) .

3. Job & Queue Monitoring

  • Tracks queued jobs (successful/failed).
  • Shows payload, connection, and processing time .

4. Exception Tracking

  • Logs all exceptions with stack traces.
  • Helps quickly debug errors in development .

5. Mail & Notification Previews

  • Captures sent emails & notifications.
  • Lets you preview emails without sending them .

6. Scheduled Tasks & Commands

  • Monitors Artisan commands & cron jobs.
  • Confirms if scheduled tasks run correctly .

7. Real-Time Dumps (dump())

  • Instead of cluttering your browser, dump() outputs appear in Telescope’s Dumps tab .

Configuring Telescope for Security & Performance

1. Restrict Access in Production

By default, Telescope is only accessible in local environments. To allow access in production, modify TelescopeServiceProvider.php:

protected function gate() {
    Gate::define('viewTelescope', function ($user) {
        return in_array($user->email, ['admin@example.com']); // Only allow specific users
    });
}

Tip: Use environment variables instead of hardcoding emails .

2. Limit Data Storage with Pruning

Telescope logs can grow quickly. Automatically prune old logs:

// In app/Console/Kernel.php
Schedule::command('telescope:prune --hours=48')->daily(); // Keeps 48 hours of logs

3. Disable Unnecessary Watchers

In config/telescope.php, disable watchers you don’t need (e.g., cache, Redis) to reduce overhead .


Best Practices for Using Telescope

Use in Local Development – Perfect for debugging without affecting performance.
Secure in Production – Restrict access via gate() and prune logs regularly.
Monitor Performance – Disable heavy watchers (e.g., queries, events) if not needed.
Combine with Laravel Logs – Telescope complements storage/logs/ for deeper debugging .


Conclusion: Why Every Laravel Developer Should Use Telescope

Laravel Telescope is a must-have tool for:
Faster debugging (queries, exceptions, jobs).
Optimizing performance (slow queries, bottlenecks).
Monitoring app behavior (requests, mails, tasks).

Whether you're a beginner or an expert, Telescope simplifies debugging and makes development smoother.

Ready to try it? Install Telescope today and take control of your Laravel app’s debugging! 🚀

Tags

Laravel Php

Comments

No comments yet. Be the first to comment!

Please log in to post a comment:

Sign in with Google

Related Posts