🧠 What is Laravel Telescope and Why Use It?
Laravel Telescope is a debug assistant for Laravel. It helps developers:
- See all requests being made
- Log queries, exceptions, jobs, and more
- Debug apps in real-time
- Improve performance and security
- Monitor long-running jobs or slow database queries
🪜 Step-by-Step Guide with Examples
🧩 Step 1: Installation
✅ Only install in --dev
environments unless you plan to use it in production with proper access control.
🧾 Step 2: Publish Telescope Files
This command:
- Creates
config/telescope.php
- Registers service providers
Think of this like setting up your telescope to start viewing what’s happening in your app.
🛠️ Step 3: Run Migrations
Why?
- Telescope stores its logs and data in your database'
🌐 Step 4: Access Telescope
Then go to:
You’ll see a powerful dashboard with:
- Requests
- Logs
- Queries
- Commands
- Jobs
- Emails
- Exceptions
- etc.
🧪 Real-Life Examples
🐞 1. Debugging a SQL Query
Telescope will automatically log:
- The raw SQL query
- Time taken
- Binding parameters
Telescope → Queries tab
📬 2. Viewing Sent Emails
When sending:
Telescope → Mail tab
🚨 3. Tracking Exceptions
If your code throws:
Telescope captures:
- The full stack trace
- Exception message
- Request URL
Telescope → Exceptions tab (Example)
🕵️ 4. Watching Jobs
Dispatch a job:
Telescope logs:
- Job class
- Payload
- Status: pending / failed / processed
- Retry count
Telescope → Jobs tab
🔐 Security Tip: Restrict Access in Production
In TelescopeServiceProvider.php
:
And in .env
:
⚠️ Only do this if you really need Telescope in production!
⚙️ Pro Tip: Configure Watchers
In config/telescope.php
:
🧾 Conclusion
Laravel Telescope gives you eyes into your application. Whether you’re debugging slow queries, missing emails, or failed jobs — Telescope makes it easy and visual.
Social Plugin