Laravel Telescope is a debug assistant for Laravel. Whenever you write code it is very hard to debug the error in your application manually. Telescope provides access to the requests coming into your application, exceptions, log entries, database queries, queued jobs, mail, scheduled tasks and more in one place.
All you need is to install the Laravel Telescope.
Table of Contents
Let's get started.
Step 1. Install Laravel Telescope
we will use the composer to Install the laravel telescope. Enter the following command to install.
composer require laravel/telescope
Note: if you want to install the laravel telescope for a specific environment. you can use below command to install
composer require laravel/telescope --dev
You can use --prod for the production installation
Once done with laravel telescope installation publish the telescope assets using laravel command
php artisan telescope:install
After publishing telescope assets run the following command to migrate
php artisan migrate
Step 2. Configure Laravel Telescope
After publishing telescope you can configure telescope according to your requirement. To do so, goto config/telescope.php and edit the file to configure.
By default, the Telescope is enabled when you publish the assets. To disable the telescope make enabled option to false.
'enabled' => env('TELESCOPE_ENABLED', false),
You will find various options when you open the telescope. For example:
- Path: Path is your main telescope dashboard. By default, it is set to telescope. You can edit and set your custom path to open the Telescope.
- Storage: Storage option determine which storage drive to store the telescope's data. By default, it is set to MySQL. You can set your custom storage drive by editing this option.
- Middleware: The middleware option you will set will be applied to each and every route. In the future, you'd want to add auth middleware so that it can be access after login.
- Watcher: Watcher options contain the array lists of watcher which are registered with the Telescope.
Following are the watchers available with the Telescope:
- Requests Watcher
- Commands Watcher
- Schedule Watcher
- Jobs Watcher
- Exceptions Watcher
- Logs Watcher
- Dumps Watcher
- Queries Watcher
- Models Watcher
- Events Watcher
- Mail Watcher
- Notifications Watcher
- Gates Watcher
- Cache Watcher
- Redis Watcher
Step 3. Use of telescope
Once you are done with the above configurations. Let's open and explore. To open telescope in your browser append /telescope with your root domain. Eg: You can open this URL to access the Laravel Telescope with
Below is the screenshot of Laravel Telescope dashboard demo