Laravel Telescope is a powerful debugging and profiling tool for Laravel applications. To configure Laravel Telescope for monitoring and profiling API requests, you can follow these steps:
Install Telescope: Start by installing Telescope via Composer:
bashcomposer require laravel/telescope
Publish Configuration and Assets: Publish Telescope configuration and assets using the following Artisan commands:
bashphp artisan telescope:install
php artisan migrate
Configure Middleware (Optional):
If you want to monitor API requests, you may want to include the Telescope middleware in your API routes. Open your app/Http/Kernel.php
file and add the \Laravel\Telescope\Http\Middleware\TelescopeMiddleware::class
to the $middleware
array. You can add it globally or for specific routes.
phpprotected $middleware = [
// ...
\Laravel\Telescope\Http\Middleware\TelescopeMiddleware::class,
];
Configure Telescope:
Open the config/telescope.php
file and review the configuration options. You can customize settings such as the path for the Telescope dashboard, database driver, and more.
Monitor API Requests:
With Telescope configured, you can now monitor API requests by visiting the Telescope dashboard in your browser. By default, you can access it at /telescope
.