Laravel

A Complete Guide To Laravel Telescope

A Complete Guide To Laravel Telescope: Today’s Laravel Telescope is a most leading topic. It is a new debugging tool for Laravel Application which was developed by Mohamed Said and Taylor Otwell. It is also called as an elegant debugger assistant.

I am going to give you a complete guide to Laravel Telescope. Here, You will learn how to install it and use it in your local Laravel Project.

A Complete Guide To Laravel Telescope

The

Telescope

debugging tool will be useful for large Laravel Application because using it; You can trace all the requests coming into your application, commands, queries, log entries, exceptions, notifications, schedule, queued jobs and more.

Installing and setup Telescope in your Laravel Project is easy.

#1: Install Telescope Using Composer

Install Telescope package in your existing Laravel Project by typing the below command in your terminal.

installing telescope

After installing, You need to run following artisan commands to publish its assets and migration.

#2: Configure Telescope

After publishing, you will show a telescope.php file in your config directory. Now, you can change the configuration of it according to your requirement. You can also disable the telescope by changing the value of ‘enabled’ option to false.

In the telescope.php file, There are following configuration options

  • Path: It defines a path to open telescope main dashboard. The default path is “telescope”, but you can also define your custom path to open telescope.
  • Storage: In storage option, you can set a database connection name to store all data in particular database’s table. By Default, it is mysql.
  • Middleware: In this option, you can specify your own middleware to this list or change the existing one which will be assigned to each and every Telescope route. By default it is web middleware.
  • Watcher: It will monitor all the tasks which you perform in your web application So, This option will give you a chance to change its value according to your needs.

#3: Telescope Watchers

Telescopes will furnish the following Watchers.

  • 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

#4: Telescope Usage

Above, you have seen installation and configuration steps of Telescope. Now, let’s use it!

To open the main telescope dashboard, Type /telescope after your root domain. Here, our laravel project URL is http://telescope-demo.test. So, I will open the telescope by typing http://telescope-demo.test/telescope. Here, is the main dashboard.

laravel-telescope

#5: Requests Watcher

It will display lists of all the HTTP requests coming into your application.

Request Watcher

Above, you can see some GET requests. Now, you can also see more details about the request by clicking the eye icon button like:

Request Watcher Detail

Here, you can see basic detail of the request, its related header, session data and some metadata about the response.

#6: Commands Watcher

It will monitor command which you perform in laravel project and show a list of that commands with their exit codes in this watcher. You can see all the arguments, options and related items of the command.

Command Watcher

#7: Exceptions Watcher

It displays all the exception lists occurred in laravel project.

Exceptions Watcher

#8: Logs Watcher

Lists all the log message and level when it happened in laravel project.

Log Watcher

#9: Queries Watcher

It will show a list of all executed queries with execution time in laravel project. You can see more detail about the query by clicking the eye button.

Queries Watcher

Queries Watcher Detail

#10: Dump Watcher

Dump Watcher is like add() function. It will show a list of dump messages in this watcher if you use dump() in your code. Actually, It only shows in the telescope, not in your code.

#11: Models Watcher

It will trance all the activities of the model which you perform an operation with it.

Model Watcher

#12: Event Watcher

It will display a list of events which is happened in laravel project.

Event Watcher

#13: Mail Watcher

It will show a list of all of the emails which you sent.

Mail Watcher

Finally,

Laravel Telescope tutorial

is over. This is amazing features of Telescope. I hope you will learn from this tutorial. Thank you.


About the author

Siddharth Ghedia

Hi, my name is Siddharth. I'm from Rajkot, Gujarat, India. I'm passionate about Laravel. I have over 4 years of experience in Web Development. I work in the technologies like: Laravel, Vue, React, React Native, Angular, IONIC.

I've created this blog for sharing my knowledge with other developer who are willing to start and build their career in the technologies that I work in.

Leave a Comment