Laravel Telescope
Introduction
Laravel Telescope makes a wonderful companion to your local Laravel development environment. 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.
Installation
You may use the Composer package manager to install Telescope into your Laravel project:
composer require laravel/telescope
After installing Telescope, publish its assets using the telescope:install
Artisan command. After installing Telescope, you should also run the migrate
command in order to create the tables needed to store Telescope's data:
php artisan telescope:install
php artisan migrate
Migration Customization
If you are not going to use Telescope's default migrations, you should call the Telescope::ignoreMigrations
method in the register
method of your application's App\Providers\AppServiceProvider
class. You may export the default migrations using the following command: php artisan vendor:publish --tag=telescope-migrations
Local Only Installation
If you plan to only use Telescope to assist your local development, you may install Telescope using the --dev
flag:
composer require laravel/telescope --dev
php artisan telescope:install
php artisan migrate
After running telescope:install
, you should remove the TelescopeServiceProvider
service provider registration from your application's config/app.php
configuration file. Instead, manually register Telescope's service providers in the register
method of your App\Providers\AppServiceProvider
class. We will ensure the current environment is local
before registering the providers:
/**
* Register any application services.
*
* @return void
*/
public function register()
{
if ($this->app->environment('local')) {
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
$this->app->register(TelescopeServiceProvider::class);
}
}
Finally, you should also prevent the Telescope package from being auto-discovered by adding the following to your composer.json
file:
"extra": {
"laravel": {
"dont-discover": [
"laravel/telescope"
]
}
},
Configuration
After publishing Telescope's assets, its primary configuration file will be located at config/telescope.php
. This configuration file allows you to configure your watcher options. Each configuration option includes a description of its purpose, so be sure to thoroughly explore this file.
If desired, you may disable Telescope's data collection entirely using the enabled
configuration option:
'enabled' => env('TELESCOPE_ENABLED', true),