Laravel telescope basic setup

  2 weeks ago     Views:  34  

Laravel provide some official packages which are easy to use with its applications. Telescope is one of the best package to use for developers. Using this package developers can keep track of whole applicaion activity. It allows various features which you can enable or disable according to your need.

In this tutorial we will show you the steps to install and how can you manage the various options available in the package.

Step - 1 : Create new laravel application

First we need to create laravel 8 application in our local system help of run the following command in terminal.

composer create-project --prefer-dist laravel/laravel telescope_demo

Step - 2 : Install package

composer require laravel/telescope

Step - 3 : Publish and run migration

php artisan telescope:install 

php artisan migrate

Step - 4 : Changes for other than local environment

Telescope by default does not allow access to the data stored by it while not in local environment. Here telescope decides the environment from value of "APP_ENV" of .env file.

To access it from other environment we need to mention which users are allowed in the service provider "TelescopeServiceProvider.php" file as below.

Solution 1:

protected function gate()
    Gate::define('viewTelescope', function ($user) {
        return in_array($user->email, [

Solution 2:

protected function gate()
    Gate::define('viewTelescope', function ($user) {
        return in_array($user->id, [

Step - 5 : Additional settings


By default all data will be removed after 24 hours. You can customize this by scheduling telescope:prune command. You can schedule command by inserting following line in schedule function of Kernel.php file.

protected function schedule(Schedule $schedule)
	$schedule->command('telescope:prune --hours=48')->daily();        

Other settings

Telescope has its own seperate configuration file available at config/telescope.php. You can disable the unnecessary entries from here. by default all the watchers are enabled.

All the watchers listed under 'watchers' in config file.

Step - 6 : View Telescope dashboard

You can view telescope dashboard using following path.



Was this article helpful?

0 out of 0 person found this article helpful.

Leave a comment


No Comments