fruitcake/laravel-telescope-toolbar
Installation
composer require fruitcake/laravel-telescope-toolbar
Publish the config (optional, but recommended for customization):
php artisan vendor:publish --provider="Fruitcake\TelescopeToolbar\TelescopeToolbarServiceProvider"
Enable the Toolbar
Add the middleware to your app/Http/Kernel.php:
protected $middlewareGroups = [
'web' => [
// ...
\Fruitcake\TelescopeToolbar\Middleware\TelescopeToolbar::class,
],
];
First Use Case
config/telescope-toolbar.php to change the toolbar’s position (e.g., top-right):
'position' => 'top-right',
resources/views/vendor/telescope-toolbar/toolbar.blade.php) or use CSS:
.telescope-toolbar { background: #2d3748; }
// In Kernel.php
\Fruitcake\TelescopeToolbar\Middleware\TelescopeToolbar::except([
'admin/*',
'api/*',
]);
// config/telescope-toolbar.php
'enabled' => env('APP_ENV') !== 'production',
TelescopeToolbar::addPanel() method in a service provider:
TelescopeToolbar::addPanel(
'custom-panel',
function () {
return [
'title' => 'My Custom Data',
'content' => 'Hello from custom panel!',
];
}
);
telescope.toolbar.panels events to dynamically modify panels:
event(new TelescopeToolbarPanels);
composer require laravel/telescope
php artisan telescope:install
Telescope::log('custom_event', [
'data' => 'value',
]);
Toolbar Not Showing?
Kernel.php.config/telescope.php).Double Toolbars
laravel-debugbar and this package, disable one or configure them to avoid conflicts:
'debugbar' => false, // in config/telescope-toolbar.php
Performance Overhead
'enabled' => env('APP_ENV') !== 'production',
CSRF Token Mismatch
web middleware group (which includes CSRF protection)./telescope to confirm entries are being logged for the current request./telescope-toolbar/data.php artisan view:clear
php artisan cache:clear
Custom Data in Panels
Extend the TelescopeToolbarPanel class to create reusable panels:
class MyPanel extends TelescopeToolbarPanel
{
public function title()
{
return 'My Panel';
}
public function content()
{
return '<div>Custom content</div>';
}
}
Register it in a service provider:
TelescopeToolbar::addPanel(new MyPanel());
Override Blade Templates Publish and modify the toolbar’s Blade templates:
php artisan vendor:publish --tag=telescope-toolbar-views
Localization Translate toolbar labels by publishing the language files:
php artisan vendor:publish --tag=telescope-toolbar-lang
Then override resources/lang/vendor/telescope-toolbar/*.php.
? to toggle the toolbar quickly (if using the default JavaScript)..telescope-toolbar.dark-mode { background: #1a202c; color: white; }
except method in the middleware to keep APIs clean:
TelescopeToolbar::except(['api/*']);
except to log only failed requests:
Telescope::except([
'telescope::*',
'horizon::*',
]);
How can I help you explore Laravel packages today?