/ laravel

Laravel Telescope

GitHub | Website

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.

Installation

Telescope requires Laravel 5.7.7+.

By default Telescope its only available on your local development.
For more details, check the file TelescopeServiceProvider.php

...
Telescope::filter(function (IncomingEntry $entry) {
    if ($this->app->isLocal()) {
        return true;
    }
...    

On the same file, using the function protected function gate() and email can be set for developement:

...
 return in_array($user->email, [
    'dev@domain.local'
   ]);
...

Using Composer to install Telescope into your Laravel project:
composer require laravel/telescope

Running the following command:
php artisan
We can confirm that a few others commands are now also available, meaning that was correctly register with laravel:

...
telescope
  telescope:clear      Clear all entries from Telescope
  telescope:install    Install all of the Telescope resources
  telescope:prune      Prune stale entries from the Telescope database
  telescope:publish    Publish all of the Telescope resources
...

After installing Telescope, publish its assets using the telescope:install Artisan command:
php artisan telescope:install

After installing Telescope, you should also run the migrate command:
php artisan migrate
We can confirm on the DB that 3 new tables have been added:

telescope_entries
telescope_entries_tags
telescope_monitoring

To access now to the Telescope page, just need to try adding on your project url /telescope:
http://<domain>:<port>/telescope

Debugging

Adding or using on the code the function:
dump($variable)
Telescope will store/monitoring this data on is dashboard, on Dumps tab, helping developers to quickly debug the application.

Note that it may required to restart your local server to allow that Telescope catch all events.

Laravel Telescope
Share this

Subscribe to NL Slack