Laravel Telescope is a powerful debugging assistant for Laravel applications. It provides a real-time UI dashboard that helps developers monitor and debug various activities in the application.
It tracks:
- Requests
- Exceptions
- Database queries
- Scheduled tasks
- Queued jobs
- Notifications
- Cache operations
- Logs
- Events
Why use Laravel Telescope?
To monitor performance issues
To track errors and exceptions
To debug queries and jobs
It’s especially useful during development phase
Installation
bashCopyEditcomposer require laravel/telescope --dev
php artisan telescope:install
php artisan migrate
Telescope will be available at /telescope
route
Basic Syntax & Usage
Tracking a query:
Telescope automatically logs this:
phpCopyEditUser::where('email', 'test@example.com')->first();
Tracking an Exception:
phpCopyEditthrow new \Exception("Custom error");
These will appear in the Telescope dashboard without additional setup.
🔹 Real-World Use Case
Imagine your application is slow, and you’re not sure why. Using Laravel Telescope, you can:
- See slow queries and optimize them
- View all HTTP requests
- Check what events or jobs were triggered
- View failed jobs or exceptions
It helps you trace exactly what’s happening in your app.
✅ Hindi Explanation (For Interviews)
🔹 Laravel Telescope क्या है?
Laravel Telescope एक डेवेलपर टूल है जो आपके Laravel एप्लिकेशन को debug और monitor करने में मदद करता है। यह एक UI डैशबोर्ड देता है जिसमें आप रियल टाइम में देख सकते हैं:
- HTTP Requests
- Errors / Exceptions
- Database Queries
- Background Jobs
- Mail और Notifications
- Caching
- Events
- लॉग्स
🔹 क्यों इस्तेमाल करें?
- डेवलपमेंट के समय ऐप के अंदर क्या हो रहा है, यह जानने के लिए
- एरर को जल्दी ट्रैक और फिक्स करने के लिए
- स्लो क्वेरीज और परफॉर्मेंस इश्यू को पहचानने के लिए
🔹 Installation
bashCopyEditcomposer require laravel/telescope --dev
php artisan telescope:install
php artisan migrate
अब /telescope
पर डैशबोर्ड एक्सेस कर सकते हैं।
🔹 Syntax / उदाहरण
क्वेरी को ट्रैक करना:
phpCopyEdit$users = User::all();
एरर को ट्रैक करना:
phpCopyEditthrow new \Exception("Something went wrong");
Telescope यह सब अपने आप रिकॉर्ड कर लेता है।
🔹 Real-World Example (Interview Style)
मान लीजिए आपके Laravel ऐप में कुछ स्लो हो रहा है।
Laravel Telescope से आप/telescope
डैशबोर्ड पर जाकर देख सकते हैं:
- कौन सी क्वेरी ज्यादा टाइम ले रही है?
- कौन सी API को ज्यादा बार हिट किया जा रहा है?
- कोई error या exception आया क्या?
इससे आपको root problem तुरंत मिल सकती है।
✅ Interview Tips
Q: What is Laravel Telescope?
Answer:
Laravel Telescope is a debug assistant for Laravel. It provides a UI dashboard where developers can monitor HTTP requests, database queries, exceptions, logs, queued jobs, and more.
Q: How do you install Telescope?
Answer:
bashCopyEditcomposer require laravel/telescope --dev
php artisan telescope:install
php artisan migrate
Then visit: /telescope
Q: Can you name 3 things Laravel Telescope can monitor?
Answer:
- Database queries
- Exceptions and errors
- Jobs and queue processing