Installation:
composer require yacoubalhaidari/filament-tour
No additional configuration is required for basic usage—just register the plugin in your PanelProvider.
First Use Case: Trigger the tour via the Tour button in the Filament user menu (top-right dropdown). This opens a default welcome screen with a "Start Tour" button.
Where to Look First:
config/filament-tour.php (default settings)app/Providers/Filament/AdminPanelProvider.php (registration)Registering the Plugin:
// app/Providers/Filament/AdminPanelProvider.php
public function panel(Panel $panel): Panel
{
return $panel
->plugin(FilamentTourPlugin::make())
->id('admin');
}
Customizing Tour Steps:
Define steps in a TourSteps class (e.g., app/Models/TourSteps.php):
use FilamentTour\TourSteps;
class CustomTourSteps extends TourSteps
{
public static function getSteps(): array
{
return [
[
'title' => 'Welcome to the Dashboard',
'text' => 'This is your starting point.',
'attachTo' => '.filament-main-content',
'buttons' => [
['text' => 'Next', 'type' => 'next'],
],
],
// Add more steps...
];
}
}
Register the custom steps in PanelProvider:
->plugin(FilamentTourPlugin::make()
->tourSteps(CustomTourSteps::class)
)
Dynamic Step Logic: Use closures for dynamic content (e.g., fetch user-specific data):
'text' => fn () => "Hello, {$this->auth->user()->name}! This is your tour.",
Conditional Tours: Restrict tours to specific users/roles:
->canAccessTour(fn () => auth()->user()->isAdmin())
resources/lang/).filament-tour-styles.css) for custom styling.tour.started or tour.finished events for analytics/logging.Asset Loading:
php artisan optimize:clear
public/js and public/css directories are writable.Step Targeting:
.filament-main-content) for attachTo. Avoid overly generic selectors like body.Caching:
Ctrl+F5) or clear cache during development.console.error // Shepherd.js errors
getSteps().Custom Buttons: Add custom buttons to steps:
'buttons' => [
['text' => 'Skip', 'type' => 'cancel'],
['text' => 'Save & Continue', 'type' => 'next', 'action' => 'saveData'],
],
Handle actions via JavaScript (extend filament-tour-scripts.js).
Welcome/Finish Screens: Customize the default screens by overriding views:
->welcomeView('filament-tour::welcome')
->finishView('filament-tour::finish')
Publish views first:
php artisan vendor:publish --tag="filament-tour-views"
Tour Completion Tracking:
Use Laravel’s session or a database to track completed tours:
session()->put('tour_completed', true);
Check in middleware or controllers:
if (!session()->has('tour_completed')) {
return redirect()->route('filament.admin.tour');
}
TourSteps classes for varied user groups.->loadAssetsOnlyWhenActive()
How can I help you explore Laravel packages today?