$ lexprog.com

// notes from an old coder -- php, databases, and the occasional rant

[September 03, 2026] Laravel

Laravel Telescope: Debug Toolbar

Laravel Telescope: Debug Toolbar

────────────────────────────────────────────────────────

Laravel Telescope: Debug Toolbar

Tip: Install Telescope

composer require laravel/telescope --dev
php artisan telescope:install
php artisan migrate

Gotcha: Dev Only

public function shouldRegister(): bool
{
    return $this->app->environment('local');
}

Tip: Query Monitoring

Telescope logs every database query with execution time and bindings.

Gotcha: Exception Tracking

All exceptions are logged with full stack traces and context.

Tip: Mail Preview

Preview all sent emails in the Telescope dashboard.

Gotcha: Performance Impact

Telescope adds overhead. Never enable in production.

Tip: Use route:cache Carefully

php artisan route:cache is fast, but it doesn't work with closure-based routes. Every time you cache routes, Laravel serializes them. If you have Route::redirect() or closure callbacks, the cache breaks. Stick to controller-based routes in production.

Tip: Model APP_KEY Rotation

Rotating APP_KEY invalidates all encrypted data — cookies, encrypted DB columns, and password reset tokens. If you must rotate (e.g., after a leak), plan a migration that re-encrypts existing data with the new key.

Gotcha: Local Scope Leaks

Global scopes defined in booted() apply to ALL queries on that model — including relationships. An innocent User::all() in admin panel might exclude soft-deleted users if a global scope is active.

Senior Insight

Telescope is an excellent debugging tool, but it has a dirty secret: it writes to the database on every request. In high-traffic applications, Telescope can cause more database load than the application itself. I only enable Telescope in local and staging environments, and I never leave it running in production. For production debugging, I rely on structured logging and Pulse. Also, regularly prune Telescope's data table — it grows fast.

Source: Laravel News (https://laravel-news.com/), Freek.dev (https://freek.dev/tags/laravel), Spatie Blog (https://spatie.be/blog)

────────────────────────────────────────────────────────
<-- back to posts