Easily add Laravel Telescope and Horizon to Filament admin panel.
You can install the package via composer:
composer require stephenjude/filament-debugger
Run the setup command using
php artisan filament-debugger:install
This is the contents of the published config file:
return [
'debuggers' => [
'horizon',
'telescope'
],
'authorization' => false,
'permissions' => [
'horizon' => 'horizon.view',
'telescope' => 'telescope.view',
],
];
This package comes with first party Laravel packages for development and monitoring your Laravel application.
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. Documentation.
Horizon allows you to easily monitor key metrics of your queue system such as job throughput, runtime, and job failures. Documentation.
Now you can view the installed debuggers when you log in into your filament admin panel.
When using filament debuggers (Horizon & Telescope) in production environment, we need to make sure that they are accessible to the authorized filament admin user.
To achive this, we need to use filament default authorization guard and the permissions provided in this package by overidding the gate()
and authorization()
methods inside the HorizonServiceProvider and TelescopeServiceProvider respectively.
We need to set authorization to true
inside the filament debugger config if we want to make it visible to only users with correct access in the admin panel navigation.
protected function gate()
{
Gate::define('viewHorizon', function ($user) {
return $user->can(config('filament-debugger.permissions.horizon'));
});
}
protected function authorization()
{
Auth::setDefaultDriver(config('filament.auth.guard'));
parent::authorization();
}
protected function gate()
{
Gate::define('viewTelescope', function ($user) {
return $user->can(config('filament-debugger.permissions.telescope'));
});
}
protected function authorization()
{
Auth::setDefaultDriver(config('filament.auth.guard'));
parent::authorization();
}
To make use of the permissions configured in this package we need a permission package like Laravel Permissions or Bouncer which usually comes with the Permission
Model. USe what works for you.
The permissions we need to create is already defined inside the filament debugger config file.
Here is an example using the Spatie Permission Package:
use Spatie\Permission\Models\Permission;
collect(config('filament-debugger.permissions'))
->map(fn($permission) => Permission::firstOrCreate([
'name' => $permission,
'guard_name' => config('filament.auth.guard'),
]));
You can also use your already created permission by updating the permission configuration:
'permissions' => [
'horizon' => 'your horizon permission name',
'telescope' => 'your telescope permission name',
],
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.