introduce

Telescope is an elegant debugging assistant that provides a wealth of debugging functionality that makes development and debugging a lot easier. If you’ve been debugging your projects using Clockwork or Laravel Debugbar, you now have a new option. For now, however, the expansion pack should only support Laravel 5.7 and above. In this lesson, we will test a quick installation in a 5.7 project.

The installation

The current expansion pack requires Laravel to be larger than ~5.7.7, so you can update your version using Composer update. I’m currently using Laravel 6.18.10.

composer require laravel/telescope
Copy the code

Ps: If you are using a Laravel version below 8, you will be prompted that the framework version is too low

Go to Packagist.org to find the right package version for your version. I used V3.5.1

Composer require laravel/telescope: v3.5.1Copy the code

Run the extension package installation command

php artisan telescope:install
Copy the code
php artisan migrate
Copy the code

You can see that three new databases have been added

access

Go directly to the domain/Telescope to see the Telescope interface.

Running in the local environment for the project,APP_ENV=localThe user can access the interface at will

Clean up the data

If not cleaned, the Telescope_entries table could quickly accumulate records. To alleviate this, you need to clean up old data by scheduling the task daily through the Artisan command Telescope: Prune:

$schedule->command('telescope:prune')->daily();
Copy the code

By default, all data up to 24 hours old is wiped, and you can use the hours option while running the above command to determine how long you want to save Telescope data for. For example, the following command will delete all data created 48 hours ago:

$schedule->command('telescope:prune --hours=48')->daily();
Copy the code

conclusion

See the official documentation for more tips