Laravel Telescope: A Powerful Debugging Tool for Your Laravel App

Debugging and monitoring Laravel applications can be challenging. Laravel Telescope provides developers with deep insights into requests, database queries, jobs, exceptions, cache operations, and more through a beautiful UI.

Laravel Telescope

What is Laravel Telescope?

Laravel Telescope is an official debugging assistant that allows developers to inspect:

  • Incoming requests
  • Database queries
  • Exceptions and errors
  • Jobs and queues
  • Cache operations
  • Scheduled tasks

It provides a real-time dashboard for monitoring application performance.


How to Install Laravel Telescope

Step 1: Install via Composer

composer require laravel/telescope --dev

Telescope is primarily for development, so install as a dev dependency.

Step 2: Publish Telescope Assets

php artisan telescope:install

This creates configuration files and necessary database tables.

Step 3: Run Migrations

php artisan migrate

This ensures Telescope can store logs and monitoring data.


How to Access Laravel Telescope

After installation, visit:
http://your-app.test/telescope

The dashboard will display requests, queries, exceptions, jobs, cache operations, and scheduled tasks.


Key Features of Laravel Telescope

  • Request Monitoring: Tracks HTTP requests, methods, response codes, and times.
  • Database Query Debugging: Logs all SQL queries and highlights slow queries.
  • Exception Tracking: Captures errors with detailed stack traces.
  • Job & Queue Monitoring: Tracks queued jobs and identifies failed ones.
  • Cache & Redis Monitoring: Monitors cache get, put, forget operations.
  • Scheduled Task Logging: Logs all scheduled tasks running in kernel.php.

Restricting Telescope Access in Production

Telescope should not be publicly accessible in production. Update the gate in app/Providers/TelescopeServiceProvider.php:

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

Disabling Telescope Completely

Set in your .env file:

TELESCOPE_ENABLED=false

Or remove the package:

composer remove laravel/telescope
php artisan migrate:rollback --step=1

Conclusion

Laravel Telescope is a must-have for Laravel developers, offering real-time insights into requests, queries, exceptions, jobs, cache, and scheduled tasks. It simplifies debugging, helps identify performance bottlenecks, and improves development efficiency.

With easy installation, a clear dashboard, and powerful monitoring features, Telescope saves developers valuable debugging time while providing deep insights into application behavior.


Frequently Asked Questions

What is Laravel Telescope?+
How do I install Laravel Telescope?+
How can I access Laravel Telescope?+
Can I restrict access to Telescope in production?+
Is Laravel Telescope safe to use in production?+