Top Related Projects
Debugbar for Laravel (Integrates PHP Debug Bar)
Clockwork - php dev tools in your browser - server-side component
Laravel N+1 Query Detector
:dromedary_camel: Laravel log viewer
Quick Overview
Laravel Telescope is an elegant debug assistant for the Laravel PHP framework. It provides insight into the requests coming into your application, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, variable dumps, and more.
Pros
- Comprehensive debugging and monitoring capabilities
- User-friendly interface for easy navigation and analysis
- Minimal performance impact when used in production
- Customizable and extendable through watchers and tags
Cons
- Requires additional setup and configuration
- Can potentially expose sensitive information if not properly secured
- May increase application size and complexity
- Limited to Laravel applications only
Code Examples
- Registering Telescope in your application:
use Laravel\Telescope\TelescopeServiceProvider;
public function register()
{
if ($this->app->environment('local')) {
$this->app->register(TelescopeServiceProvider::class);
}
}
- Customizing Telescope's authorization:
use Laravel\Telescope\Telescope;
Telescope::auth(function ($request) {
return $request->user()->isAdmin();
});
- Tagging records for easier filtering:
use Laravel\Telescope\Telescope;
Telescope::tag(function (IncomingEntry $entry) {
if ($entry->type === 'request') {
return ['status:' . $entry->content['response_status']];
}
return [];
});
Getting Started
-
Install Telescope via Composer:
composer require laravel/telescope
-
Publish Telescope's assets:
php artisan telescope:install
-
Run database migrations:
php artisan migrate
-
Access Telescope dashboard at
/telescope
in your Laravel application.
Competitor Comparisons
Debugbar for Laravel (Integrates PHP Debug Bar)
Pros of Laravel Debugbar
- Lightweight and easy to set up
- Provides real-time debugging information directly in the browser
- Offers detailed query analysis and timeline visualization
Cons of Laravel Debugbar
- Limited to browser-based debugging
- May impact performance in production environments if not properly configured
- Less comprehensive in terms of long-term monitoring and analysis
Code Comparison
Laravel Debugbar:
use Barryvdh\Debugbar\Facade as Debugbar;
Debugbar::info('Info message');
Debugbar::error('Error message');
Debugbar::warning('Warning message');
Telescope:
use Laravel\Telescope\Telescope;
Telescope::recordException($exception);
Telescope::recordJob($job);
Telescope::recordLog('info', 'Log message');
Key Differences
-
Scope: Debugbar focuses on real-time browser-based debugging, while Telescope offers a broader monitoring and debugging solution.
-
Interface: Debugbar displays information directly in the browser, whereas Telescope provides a separate dashboard interface.
-
Performance Impact: Debugbar may have a higher performance impact when enabled, while Telescope is designed for minimal overhead in production.
-
Data Persistence: Telescope stores debugging data for later analysis, while Debugbar primarily focuses on current request information.
-
Integration: Telescope is more tightly integrated with Laravel's ecosystem and offers more extensive monitoring capabilities for various Laravel components.
Clockwork - php dev tools in your browser - server-side component
Pros of Clockwork
- Lightweight and easy to set up, with minimal configuration required
- Works with multiple PHP frameworks, not limited to Laravel
- Provides a browser extension for a more integrated debugging experience
Cons of Clockwork
- Less feature-rich compared to Telescope's extensive monitoring capabilities
- May require additional setup for advanced features
- Limited built-in authentication and authorization options
Code Comparison
Clockwork:
use Clockwork\Support\Clockwork;
Clockwork::info('User logged in');
Clockwork::startEvent('long-operation', 'Performing a long operation');
// ... operation code ...
Clockwork::endEvent('long-operation');
Telescope:
use Laravel\Telescope\Telescope;
Telescope::recordException($exception);
Telescope::tag(['user:' . $user->id]);
Telescope::listen(QueryExecuted::class, function ($query) {
// Custom query logging
});
Both tools offer ways to log and monitor application events, but Telescope provides more built-in features for Laravel-specific monitoring. Clockwork's API is simpler and more straightforward, while Telescope offers more extensive customization options within the Laravel ecosystem.
Clockwork is better suited for developers working across multiple PHP frameworks or those who prefer a lightweight solution. Telescope is ideal for Laravel developers who need comprehensive monitoring and are willing to invest time in setting up a more robust debugging environment.
Laravel N+1 Query Detector
Pros of Laravel Query Detector
- Lightweight and focused specifically on detecting N+1 queries
- Provides real-time notifications in the browser for easy identification
- Can be easily integrated into existing Laravel projects with minimal setup
Cons of Laravel Query Detector
- Limited to query detection and doesn't offer broader application insights
- May require additional tools for comprehensive debugging and monitoring
- Less actively maintained compared to Telescope
Code Comparison
Laravel Query Detector:
// In AppServiceProvider.php
public function boot()
{
if ($this->app->environment('local')) {
$this->app->register(\BeyondCode\QueryDetector\QueryDetectorServiceProvider::class);
}
}
Telescope:
// In AppServiceProvider.php
public function register()
{
if ($this->app->environment('local')) {
$this->app->register(TelescopeServiceProvider::class);
}
}
Summary
Laravel Query Detector is a lightweight tool focused on detecting N+1 queries, offering real-time browser notifications. It's easy to integrate but limited in scope compared to Telescope. Telescope provides comprehensive application insights and debugging tools but may be considered overkill for projects only needing query optimization. The choice between the two depends on the specific needs of the project and the level of monitoring required.
:dromedary_camel: Laravel log viewer
Pros of Laravel Log Viewer
- Lightweight and focused solely on log viewing
- Easy to install and set up with minimal configuration
- Provides a simple, user-friendly interface for browsing log files
Cons of Laravel Log Viewer
- Limited to log file viewing, lacking broader application insights
- Does not offer real-time monitoring or advanced filtering options
- Less integrated with Laravel's ecosystem compared to Telescope
Code Comparison
Laravel Log Viewer:
Route::get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index');
Telescope:
use Laravel\Telescope\Telescope;
Telescope::night();
Telescope::filter(function (IncomingEntry $entry) {
return $entry->isReportableException() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
$entry->hasMonitoredTag();
});
Summary
Laravel Log Viewer is a simple, lightweight tool focused on viewing log files, while Telescope is a comprehensive debugging and monitoring package for Laravel applications. Log Viewer is easier to set up and use for basic log viewing, but Telescope offers more advanced features and deeper integration with Laravel's ecosystem. The choice between the two depends on the specific needs of the project and the level of insight required into the application's performance and behavior.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Introduction
Laravel Telescope is an elegant debug assistant for the Laravel framework. Telescope provides insight into the requests coming into your application, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, variable dumps and more. Telescope makes a wonderful companion to your local Laravel development environment.
Official Documentation
Documentation for Telescope can be found on the Laravel website.
Contributing
Thank you for considering contributing to Telescope! The contribution guide can be found in the Laravel documentation.
Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
License
Laravel Telescope is open-sourced software licensed under the MIT license.
Top Related Projects
Debugbar for Laravel (Integrates PHP Debug Bar)
Clockwork - php dev tools in your browser - server-side component
Laravel N+1 Query Detector
:dromedary_camel: Laravel log viewer
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot