laravel/telescope
Laravel Telescope is an elegant debug assistant for Laravel, giving you insight into requests, exceptions, logs, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, and variable dumps. A perfect companion for local development.
Install Telescope as a development dependency, publish its assets/config, and migrate its storage tables:
composer require laravel/telescope --dev
php artisan telescope:install
php artisan migrate
On newer Laravel versions you may also use the framework installer command:
php artisan install:telescope
Open /telescope in your local environment. If the UI is not reachable, check authorization first. Telescope registers a viewTelescope gate in App\Providers\TelescopeServiceProvider; by default access is limited to the local environment. For shared staging environments, extend that gate deliberately:
protected function gate(): void
{
Gate::define('viewTelescope', function ($user) {
return in_array($user->email, [
'[email protected]',
]);
});
}
The first day-to-day use case is debugging a slow or failing page:
For terminal-first workflows, php artisan telescope:list exposes recorded entries and batches without opening the web UI. That is useful in agent-driven or SSH-only environments.
Telescope records a lot by default. Review config/telescope.php and disable watchers you do not need, especially outside local development:
'watchers' => [
Watchers\RequestWatcher::class => [
'enabled' => env('TELESCOPE_REQUEST_WATCHER', true),
'ignore_http_methods' => ['OPTIONS'],
'ignore_status_codes' => [404, 419],
],
Watchers\QueryWatcher::class => [
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
'ignore_paths' => [
'telescope/*',
'horizon/*',
],
],
],
This is especially important for query-heavy applications, queue workers, and any environment where Telescope is enabled temporarily.
Use Telescope::filter to record only useful entries. A common pattern is to keep all exceptions/jobs but only record slow or failing HTTP requests:
use Laravel\Telescope\IncomingEntry;
use Laravel\Telescope\Telescope;
Telescope::filter(function (IncomingEntry $entry) {
if ($entry->isRequest()) {
$status = $entry->content['response_status'] ?? 200;
return $status >= 500 || ($entry->duration ?? 0) > 1000;
}
return true;
});
Be careful not to filter away the exception or job entries you actually need when investigating an incident.
Tags make it possible to connect a request, job, mail, and notification to the same user, tenant, order, or feature:
use Laravel\Telescope\IncomingEntry;
use Laravel\Telescope\Telescope;
Telescope::tag(function (IncomingEntry $entry) {
if ($entry->isRequest()) {
return array_filter([
auth()->id() ? 'user:'.auth()->id() : null,
tenant('id') ? 'tenant:'.tenant('id') : null,
]);
}
return [];
});
Then filter by tag in the UI. Tags are attached as entries are recorded, so they are not retroactive.
Every request, command, and job is recorded as a batch containing its queries, cache operations, logs, events, exceptions, and views. When debugging:
Imports, seeders, health checks, and background maintenance can flood Telescope. Wrap known-noisy code with withoutRecording:
use Laravel\Telescope\Telescope;
Telescope::withoutRecording(function () {
$this->importLargeDataset();
});
The callback’s return value is preserved, so this can wrap service calls without changing behavior.
Telescope is primarily a local tool. If you enable it outside local:
Typical config additions:
// config/telescope.php
'connection' => env('TELESCOPE_DB_CONNECTION', 'mysql'),
// app/Console/Kernel.php or routes/console.php
$schedule->command('telescope:prune')->daily();
Set TELESCOPE_ENABLED=false by default in production and opt in only when actively debugging.
Configure request redaction in the request watcher config:
Watchers\RequestWatcher::class => [
'enabled' => true,
'hide_request_parameters' => true,
'hide_request_headers' => true,
'hide_response_parameters' => true,
],
Use this in any shared environment. Even locally, it prevents passwords, tokens, and personal data from being stored in Telescope’s tables.
telescope:prune and consider a shorter retention window./telescope returns 403, inspect the viewTelescope gate. The default is local-only access.TELESCOPE_ENABLED, watcher config, or filters, run php artisan config:clear if config is cached.withoutRecording is your friend. Use it for test suites, seeders, imports, and repetitive jobs that would otherwise flood the UI. This is especially relevant for Octane and long-running workers.ignore_paths on the query watcher prevents noisy endpoints from recording SQL. Use it for health checks, Telescope itself, Horizon, and other internal routes.Telescope::filter logic. Prefer “record all exceptions, filter noisy requests” over aggressive blanket filtering.Telescope::tag.php artisan telescope:publish if the dashboard looks stale or broken.withoutRecording around high-volume loops.php artisan telescope:list is useful for quick inspection, CI/debug scripts, and environments where opening the dashboard is inconvenient.telescope:clear when you want a clean slate during development; use telescope:prune for scheduled retention. Clearing large datasets is chunked, but it still touches the database.How can I help you explore Laravel packages today?